← Cheat Sheets
Bash Files and Directories
Navigate and manage files from the shell.
# Bash Files and Directories
Navigate and manage files from the shell.
```bash
pwd # where am I
ls -la # list all, with details
cd - # previous directory
mkdir -p a/b/c # create nested folders
cp -r src dest # copy recursively
mv old new # move or rename
rm file # delete a file
rm -r folder # delete a folder (no undo!)
touch file # create or update timestamp
cat file # print file
less file # page through a file (q to quit)
head -n 20 file # first 20 lines
tail -f log.txt # follow new lines
ln -s target link # symbolic link
du -sh * # size of each item
df -h # disk space
which python3 # where a command lives
history | grep git # search past commands
```