Reading: Oswald Campesato, Bash Command Line and Shell Scripts: Pocket Primer, (Dulles, VA: Mercury Learning and Information, 2020)
history
cat
echo
head -n 5
|tail -n 5
-1
displays vertical list of file/dir names only-l
is for "longlist"-t
sorts entries by timestamp, in descending order (i.e. latest on top)-r
reverses the sort order-tr
sorts entries by timestamp, in ascending order (i.e. oldest on top)
Anatomy of ls -l
output:
drwxr-xr-x 7 zeddee staff 224 Aug 22 13:26 assets
lrwxr-xr-x 1 zeddee staff 62 Aug 22 13:26 bash-cheatsheet.md -> /Users/zeddee/working/sites/bash-cheatsheet/bash-cheatsheet.md
-rw-r--r-- 1 zeddee staff 352 Aug 21 16:39 dead-dog.md
-rw-r--r-- 1 zeddee staff 115 Aug 21 20:16 house-with-locked-windows.md
-rw-r--r-- 1 zeddee staff 1141 Aug 20 23:58 moebius.md
-rw-r--r-- 1 zeddee staff 205 Aug 21 16:34 sparkfile-aug-2020.md
drwxr-xr-x
: filetype and permissions for file- first char is file "type":
-
: Regular file. E.g., ASCII text file, binary, hard link.b
: Block special file (physical hard drive) (??).c
: Character special file (physical hard drive) (?).d
: A directory.l
: A symbolic link.p
: A named pipe.s
: A socket.
- first char is file "type":
7
: Number of memory blocks occupied by this file or dir.zeddee
: Owner of the file.staff
: Group that owns the file.224
: File size in bytes.Aug 22 13:26
: Timestamp.assets
: File or dir name.