ls1.9
Lists directory contents. -l long format (permissions, owner, group, size, date), -a includes hidden dot files, -h human-readable sizes.
When to use it: seeing what is in a folder and who owns it. ls -la is the everyday version.
ls
ls -la /etc
ls -lh ~/Downloads
pwd1.9
Print working directory: the full path of the folder you are in. Move around with cd (cd .. up, cd ~ home, cd / root).
When to use it: before running something destructive, to be sure you are where you think you are.
pwd
mv1.9
Moves or renames files and folders. There is no separate rename command. -i asks before overwriting.
When to use it: renaming a file, or moving it to another directory.
mv draft.txt final.txt
mv -i report.pdf ~/Documents/
cp1.9
Copies files. -r copies a directory and everything in it; -i asks before overwriting; -p keeps permissions and timestamps.
When to use it: backing up a config file before you edit it.
cp /etc/hosts /etc/hosts.bak
cp -r ~/Projects /media/usb/
rm1.9destructive
Removes files. -r removes directories recursively, -i asks first, -f forces without asking. There is no recycle bin at the command line.
When to use it: deleting files you are certain about. Run pwd and ls first.
rm old.log
rm -ri ~/tmp/build
chmod1.9
Changes permissions using octal (chmod 755) or symbolic notation (chmod u+x, chmod go-w). -R applies to a whole directory tree. Try the decoder below.
When to use it: making a script executable or locking a private file down to its owner.
chmod u+x backup.sh
chmod 600 ~/.ssh/id_ed25519
chmod -R 755 /var/www/site
chown1.9sudo
Changes the owner, and optionally the group, of files: chown user:group file. -R is recursive. Giving a file to someone else needs root.
When to use it: files copied as root are now owned by root and the user cannot edit them.
sudo chown jsmith:jsmith report.ods
sudo chown -R www-data:www-data /var/www/site
grep1.9
Searches text for a pattern and prints matching lines. -i ignores case, -r searches folders, -n shows line numbers, -v shows lines that do not match. Often fed by a pipe (|).
When to use it: finding an error in a log, or filtering another command's output.
grep -i "error" /var/log/syslog
ps aux | grep firefox
find1.9
Searches the directory tree for files by name, type, size, age, or owner: -name, -iname (any case), -type f or d, -size +100M, -mtime -7 (changed in the last 7 days).
When to use it: you know something about a file but not where it is. grep searches inside files; find searches for the files themselves.
find ~ -iname "*.pdf"
find / -type f -size +1G 2>/dev/null