Lesson 5: Managing the UNIX/Linux File System
Objectives
- Name the three elements of a Unix file, and where each is stored.
- Be able to distinguish between text, data, programs, and directory files.
- Know how the xxd command can be used to look at data files.
- Be able to manage the files in your home directory using:
- Managing The UNIX File System
- Filename Expansion Characters
special characters that your shell recognizes to make it easier to specify file names. (wildcards)
- * matches all non-hidden filenames in the current directory when used alone
matches zero or more characters when used as a prefix, infix or postfix.
- ? matches any single character in any of your current directory’s filenames.
- [] matches any single character contained within the brackets.
- Managing Files
- Creating
- touch
- creates an empty ordinary file(s), or if the file already exists, it updates
the time stamp.
- mkdir
- creates an empty directory(s)
options: -p
- Copying
cp <source file> <target file>
<source file> <target directory>
<source file> <source file> <target directory>
options: -i -r
- Moving
mv <source file> <target file>
<source file> <target directory>
<source file> <source file> <target directory>
- Renaming
mv <original name> <new name>
- Removing
rm <filename>...
options: -i -r -f
rmdir <directory name>
Directories must be empty for this to work
- Linking
ln <existing-name> <new-name>
options: -s