Linux commands you should know

Search for a command to run...

No comments yet. Be the first to comment.
C# is one of my favorite languages; if you're building Windows apps, you're probably better off with C#, but I'm kind of rusty, and WinForms is old school now, so I've no choice but to use WPF 😔. The

I have been thinking about where we are at with AI in 2026; I think most models have now reached their intelligence ceiling. They’ll get incrementally better over time, sure, but there’s a big difference between 10% to 80% and 80% to 100%. In most te...

Django is one of my favourite frameworks; however, the official docs are not always the best resource to look up information when you are in a hurry. Don't get me wrong, the official docs are very use

While the whole YouTube influencer space goes crazy about Gemini 3, I’m not so impressed. Don’t get me wrong, Gemini models are fantastic! And the V3 iteration is undoubtedly cool and capable. I’ve briefly run some tests (not benchmarks but actual re...

I’m learning Next.js; I know React or kinda know React since I started building React apps in 2018 or thereabout, and then stopped using it for several years. Shew! A lot has changed: Server actions, Zod, and just the whole ecosystem generally. This ...

I use open-source tooling which predominantly runs on Linux servers, therefore often I find myself in the terminal running commands to do various tasks.
In this guide - I'm going to give you a cheat sheet(sort of) of some useful and interesting commands I use often.
Have a running process and no idea what it's doing?
Using "strace", you can easily peek inside a running process and output its log info using the below command:
sudo strace -p 3612485 -e write
# Press ctrl+z and type the following:
bg
Want to run a command in a remote terminal but scared that a disconnect might stop the process prematurely?
There are two options for this, "nohup" or "screen". Screen opens the terminal in a window so even if your network disconnects - the screen will still persist.
The "nohup" command does something similar except it keeps the process running even if your network disconnects and writes to a log file.
nohup python run_my_awesome_script.py &
We use the "&" to push the process to the background immediately so that we can continue working in the terminal. Omitting this will basically lock your terminal on that command until it finishes.
To use screens:
screen -S MyScreen
To exit and keep the screen open - enter "ctrl+alt+d". If you want to go back to the screen:
# ScreenNameHere - optional - if you have only one open screen.
screen -r ScreenNameHere
lsof -i :5000
# Or
netstat -tupln | grep :5000
# Or - this one may not always give you the best results
# - as it also searches process IDs
ps aux | grep 5000
Will generate a list of processes that are using the specified port.
Rsync is a very powerful tool for syncing files incrementally, I won't go too in-depth on what the flags mean - please check the manual, however, I will cover some common use cases for rsync.
Find and copy log files that are older than 180 minutes to a backup directory.
find /var/log/nginx -type f -mmin +180 -exec rsync -av {} /backups/nginx/logs \;
Sync all files in directory /var/lib/mysql to a remote server. Set the SSH port to "9023"
rsync -rav -e 'ssh -p 9023' --progress /var/lib/mysql/ root@192.168.1.1:/var/lib/mysql2/
Simple copy - if you just want to copy files between two machines and don't care for incremental syncs.
scp -P9023 -r somefiles/ root@192.168.1.1:/tmp/
tar -czvf somestuff.tar.gz somestuff/
# And unpack
tar -xzvf somestuff.tar.gz
# Compress a single file
gzip -9 data.xml
# Uncompress single file
gzip -d data.xml.gz
# Open system monitor tool
htop
# View memory usage
free -m
# View processes
ps aux
# View CPU information
cat /proc/cpuinfo
# Disk space usage
df -h
# File/directory sizes in the current directory
du -h
# To 20 biggest files & folders in directory
du -h | sort -rh | head -n 20
These just scratch the surface of useful Linux commands that you will use often.
I didn't cover "grep", "awk", "sed" and so on, however, I do have an earlier article that does cover some of these - which you can check out here.
Hopefully, this is useful to you, please feel free to comment down below if you have any other suggestions or would like a future article on a specific area you would like me to cover.