basic skills for managing files
Restrict non-alphanumeric characters in file naming to…
_
Special use characters for filenames
* ? / \ " `
True or False: Linux filenames are case-insensitive
False
Special filenames
- double dot (..) refers to parent directory
wildcard ?
stands for a single character
wildcard *
matches zero or more characters
wildcard []
match any character in the set of characters within the square brackets
wildcard range
match any character within the range
i.e. b[a-z]ck matches back, buck, and other four letter names
common file manipulation commands
command ls
syntax: ls [OPTION]… [FILE]…
- displays the names of files in a directory
ls switches
command cp
syntax: cp [OPTION]… SOURCE… DIRECTORY
cp switches
command mv
move - commonly used to move files and directories from one location to another or to rename them
syntax: mv [OPTION]… SOURCE… DIRECTORY
mv switches
options which do not apply to mv
best practice for mv command
use trailing slash (/) to avoid typos like renaming a file instead of moving to a directory
(i.e.
mv document.doc important/purchases/ moves to directory
mv document.doc important/puchases renames to purchases)
command rm
remove
syntax: rm {options] files
rm switches
note: by default rm does not remove directories.
command touch
set modification and access time to current time
syntax: touch [options] files
touch switches
common file archiving commands
command tar