Bash: Unterschied zwischen den Versionen
Zur Navigation springen
Zur Suche springen
Geist (Diskussion | Beiträge) |
Geist (Diskussion | Beiträge) |
||
Zeile 41: | Zeile 41: | ||
'''$ ls ~/folder/*txt*''' | '''$ ls ~/folder/*txt*''' | ||
'''$ ls -R folder''' (list of subfolders) | '''$ ls -R folder''' (list of subfolders) | ||
+ | |||
'''$ ls -l''' (single column) | '''$ ls -l''' (single column) | ||
'''-''' regular file | '''-''' regular file | ||
Zeile 50: | Zeile 51: | ||
'''c''' character device | '''c''' character device | ||
'''p''' named pipe | '''p''' named pipe | ||
+ | |||
'''$ ls -m''' (comma-separated list) | '''$ ls -m''' (comma-separated list) | ||
'''$ ls -a''' (hidden files and folders) | '''$ ls -a''' (hidden files and folders) | ||
+ | |||
'''$ ls -F''' (file type) | '''$ ls -F''' (file type) | ||
Symbols and file types | Symbols and file types | ||
Zeile 59: | Zeile 62: | ||
'''|''' FIFO | '''|''' FIFO | ||
'''=''' Socket | '''=''' Socket | ||
+ | |||
'''$ ls --color (content in color)''' | '''$ ls --color (content in color)''' | ||
'''$ dircolors''' | '''$ dircolors''' | ||
Zeile 70: | Zeile 74: | ||
'''$ ls -h''' | '''$ ls -h''' | ||
'''$ ls -laS''' | '''$ ls -laS''' | ||
− | '''ls -h''' | + | '''$ ls -h''' |
Version vom 21. Februar 2022, 18:03 Uhr
Inhaltsverzeichnis
Script
$ type script $ chmod +x script $ ./script $ .script $ source script $ bash script
#!/bin/bash
Command Line
Everything is a file 255 Byte The maximum length for a file name is 255 bytes. The maximum combined length of both the file name and path name is 4096 bytes. This length matches the PATH_MAX that is supported by the operating system. Names are case-sensitive
Special chars to avoid in names/filenames
/ Never \ Escaped - Never at beginning [] Escaped {} Escaped * Escaped ' Escaped " Escaped
Wildcards
* asterisk | any char ? question mark | single char [] square brackets | set of single char or a range of chars
List files and folders
$ ls $ ls folder $ ls ./folder $ ls /path/folder $ ls ~/folder $ ls ~/folder/*.jpg $ ls ~/folder/*txt* $ ls -R folder (list of subfolders)
$ ls -l (single column) - regular file _ executable d directory l symbolic link s socket b block device c character device p named pipe
$ ls -m (comma-separated list) $ ls -a (hidden files and folders)
$ ls -F (file type) Symbols and file types * Executable / Directory @ Symbolic link | FIFO = Socket
$ ls --color (content in color) $ dircolors $ dircolors --print-database $ ls -F --color $ la -la $ ls -r $ ls -X (sort by extension) $ ls -t (sort by date) $ ls -S (sort by content) $ ls -h $ ls -laS $ ls -h