Chapter 1 Flashcards
List Files and Directories
ls
List All Files
ls -a
List Files in Long Form
ls -l
List Files with Human Readable Sizes
ls -h
List files, sorted by size
ls -S
List files, sorted by last modified time
ls -t
List files, reverse sorted
ls -r
Hard links vs a symbolic link?
Hard links create an identical copy of the linked file on disk, that gets updated automatically as the source file gets updated. That means if the content of the source is changed, so will the target file.
Unfortunately hard links do not work for directories. To create a link to a directory, we can use the -s flag to create a symbolic link. This can also be used for linking to files as well, not just directories.
Symbolic links can also link to files or directories on other file systems.
Link from source to linked file
ln a.txt b.txt
Force a link to be created
ln -f a.txt b.txt
Create a symbol link
ln -s a.txt b.txt
Navigate up a directory
cd ..
Navigate to home directory
cd
Create a directory
mkdir foo
Create intermediate directories
mkdir -p a/b/c