Back to it-tips
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.

TechNotesHub Team August 2, 2026 1 views
Log in to download the attached PDF

Linux — the daily commands

Where am I? What's here?

CommandWhat it does
pwdPrints your current directory
lsLists files & folders
ls -aAlso shows hidden files (starting with .)
ls -laLong listing (owner, size, date)
ls -RLists recursively
cd folderEnters a folder
cd ..Goes up one level
cd -Toggles back to previous directory

Files — read, create, delete

CommandWhat it does
cat filePrints file contents
cat > fileTypes a new file (Ctrl-D to save)
touch fileCreates empty file OR updates timestamp
less fileViews file page by page (/ search, q quit)
head fileFirst 10 lines
tail fileLast 10 lines
tail -f fileFollows live (great for logs)
cp src dstCopies
cp -r dir dstCopies folder recursively
mv src dstMoves / renames
rm fileDeletes (no undo!)
rm -rf dirDeletes 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

CommandWhat it does
psYour running processes
ps auxEveryone's processes
top / htopLive view of CPU/RAM
kill 1234Ask process 1234 to stop
kill -9 1234Force-kill
pkill nginxKill all processes named nginx
bgSend stopped job to background
fgBring background job to foreground
renice +10 1234Lower 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=1755 = 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

Discussion (0)

No comments yet. Be the first to weigh in.

Leave a comment

Comments are reviewed before appearing.