Module 2
Module 2
$ cat /home/yahia/myfile.txt
Linux File System
❑ Relative:
The relative path is a partial path that is relative to the current working directory; does not begin with /.
/
Root Directory
/
bin etc users tmp usr
users
john
work work play
Relative Path vs. Full Path
Absolute Path:
❑ The absolute path is a path that contains the root directory and all other subdirectories you need to
access a file.
❑ It points to the same location in the directory tree, regardless of the current working directory.
Example:
/users/john/work/linux.txt
Starting
With “/”
Relative Path vs. Full Path
Relative Path:
❑ The relative path is a partial path to a file, in relation to the current working directory.
If inside of the home directory in the previous directory example, a relative path would be:
work/linux.txt
Not Starting With “/”
Navigating the File System
Listing Directory Contents:
Usage:
❍ ls [options] [files_or_dirs]
Example:
❍ ls –a: includes hidden files.
❍ ls –l: displays extra information.
❍ ls –R: lists files and directories recursively.
❍ ls –ld: displays directory and symlink information.
Navigating the File System
Usage:
❍ cp [options] file destination
• rm -: removes files.
Usage:
rm [options] <file>...
Example:
❍ rm –i: File (Interactive)
❍ rm –r: Directory (Recursive)
❍ rm –f: File (Force)
Navigating the File System
Moving and Renaming Files and Directories
Usage:
mv [options] file destination
Examples:
“
An inode number is an entry in inode table that contains information about a file and directory.
”
Links in Linux
Creating Links