Paths, Filenames and Text Files
Spaces in filenames
📌 Use
TAB
for auto-completion.
Best pratice: do not use spaces in file names as word separators.
There are two ways to tell bash the space is part of the name:
Escape the name with a
\
(treat the space as part of the argument).Place the entire name in double quotes (do not interpret any special character inside the quotes).
File and Path Expansion
Directories and files in a path are separated by a slash
/
.Everything in between separators is called a segment.
The most used wildcard is the asterisk
*
.
[ ]
indicate very specific character to match.
Text Files Commands
head
head
- by default print the first 10 lines of each fileUse
-n
option to specify the lines to display (or -NUMBER)
tail
tail
- by default print the last 10 lines of each fileUse
-n
option to specify the lines to display (or +NUMBER)
tail command can be used to monitor the end of a file (a log) for changes.
diff
diff
- compare files line by line and displays any differences
Last updated