it-tips#linux#cheat-sheet#shell
Linux Cheat Sheet Part 1: Files, Directories & Processes
The everyday Linux commands you'll type a hundred times a week — with what they do in plain English.
Series
Linux & Git Command Reference
Linux — the daily commands
Where am I? What's here?
| Command | What it does |
|---|---|
pwd | Prints your current directory |
ls | Lists files & folders |
ls -a | Also shows hidden files (starting with .) |
ls -la | Long listing (owner, size, date) |
ls -R | Lists recursively |
cd folder | Enters a folder |
cd .. | Goes up one level |
cd - | Toggles back to previous directory |
Files — read, create, delete
| Command | What it does |
|---|---|
cat file | Prints file contents |
cat > file | Types a new file (Ctrl-D to save) |
touch file | Creates empty file OR updates timestamp |
less file | Views file page by page (/ search, q quit) |
head file | First 10 lines |
tail file | Last 10 lines |
tail -f file | Follows live (great for logs) |
cp src dst | Copies |
cp -r dir dst | Copies folder recursively |
mv src dst | Moves / renames |
rm file | Deletes (no undo!) |
rm -rf dir | Deletes folder + contents (dangerous) |
Search files
find /var/log -name "*.log" # by name
find / -type d -name node_modules # only directories
locate word.txt # fast, uses index
which python3 # where is this binary?
whereis git # binary + man page
Processes
| Command | What it does |
|---|---|
ps | Your running processes |
ps aux | Everyone's processes |
top / htop | Live view of CPU/RAM |
kill 1234 | Ask process 1234 to stop |
kill -9 1234 | Force-kill |
pkill nginx | Kill all processes named nginx |
bg | Send stopped job to background |
fg | Bring background job to foreground |
renice +10 1234 | Lower priority of PID 1234 |
command & | Run in background |
Permissions
chmod 755 script.sh # rwx r-x r-x
chmod +x file # add executable bit
chown alice file # change owner
chgrp devs file # change group
The 3 octal digits stand for owner / group / others. r=4, w=2, x=1 → 755 = 7(4+2+1)/5(4+1)/5(4+1).
Redirection & pipes
command > out.log # stdout to file (overwrite)
command >> out.log # append
command 2> err.log # stderr to file
command &> all.log # both stdout + stderr
command1 | command2 # pipe output of 1 into 2
ls | grep .py # only .py files
Real-world example
Nightly log cleanup on a small server:
find /var/log -name "*.log" -mtime +14 -delete # older than 14 days
Combined with a cron job (crontab -e) — hours of manual work gone.
Keep reading
You may also like
it-tips
Git Cheat Sheet: Every Command You'll Actually Use
From `git init` to `git rebase -i` — the practical Git workflow you'll use daily, with what each command really does.
Read
it-tips
Linux Cheat Sheet Part 2: Text, Networking, Archives, Scripting
grep / sed / awk, ssh / curl / netstat, tar / zip, and just enough Bash to write your own scripts.
Read
it-tips
10 Terminal Aliases That Save Hours a Week
Small `.zshrc` tweaks with an outsized impact on daily workflow.
Read
Discussion (0)
No comments yet. Be the first to weigh in.