Cheat Sheet

Quick reference for the most essential Linux commands.

CommandDescription
pwdPrint working directory
lsList directory contents
cd <path>Change directory
cd ~Go to home directory
cd -Go to previous directory

File Operations

CommandDescription
touch <file>Create empty file
mkdir <dir>Create directory
cp <src> <dst>Copy file/directory
mv <src> <dst>Move/rename file
rm <file>Remove file
rm -r <dir>Remove directory

Viewing Files

CommandDescription
cat <file>Display file contents
less <file>View file with pagination
head <file>Show first 10 lines
tail <file>Show last 10 lines
tail -f <file>Follow file (live updates)
CommandDescription
grep <pattern> <file>Search in file
grep -r <pattern> <dir>Search recursively
find <dir> -name <pattern>Find files
locate <name>Quick file search

Permissions

CommandDescription
chmod <perms> <file>Change permissions
chown <user> <file>Change owner
sudo <command>Run as superuser
chmod +x <script>Make executable

Package Management

Fedora (DNF)

CommandDescription
dnf search <pkg>Search package
dnf install <pkg>Install package
dnf remove <pkg>Remove package
dnf updateUpdate packages

Debian (APT)

CommandDescription
apt search <pkg>Search package
apt install <pkg>Install package
apt remove <pkg>Remove package
apt update && apt upgradeUpdate system

Processes

CommandDescription
ps auxShow all processes
topInteractive process viewer
kill <pid>Terminate process
systemctl status <svc>Service status
journalctl -u <svc>Service logs

Networking

CommandDescription
ip addrShow IP addresses
ping <host>Test connectivity
ssh user@hostRemote login
scp <src> <dst>Secure copy

Git

CommandDescription
git initInitialize repo
git statusShow status
git add <file>Stage changes
git commit -m "msg"Commit
git logShow history

Docker

CommandDescription
docker pull <img>Pull image
docker run <img>Run container
docker psList containers
docker stop <id>Stop container

Keyboard Shortcuts

ShortcutDescription
TabAuto-complete
Ctrl+CCancel command
Ctrl+LClear screen
Ctrl+AStart of line
Ctrl+EEnd of line
Ctrl+UClear to start
Ctrl+KClear to end
Ctrl+RSearch history
↑/↓Browse history