๐Ÿง Linux Cheat Sheet

Dheeraj PariharDheeraj Parihar
2 min read

Level: Beginner โ†’ Intermediate
Use: DevOps, Cloud, System Admin, Interviews


๐Ÿงฐ Essential Linux Commands

Command

Description

ls -l

List files with details

cd /path

Change directory

pwd

Show current path

cp src dest

Copy files

mv src dest

Move/rename

rm file

Remove file

mkdir folder

Create directory

find . -name "*.log"

Find files

grep "text" file

Search inside files

cat file

View content

less file

Scroll through file

df -h

Disk usage

free -m

RAM usage

top / htop

System monitor

ps aux

Show running processes

kill PID

Kill process by PID

chmod +x file

Make file executable

chown user:group file

Change ownership


๐ŸŒ Networking Commands

Command

Description

ping google.com

Check internet

curl url

Get webpage/API

wget url

Download file

scp file user@ip:/path/

Secure copy

ssh user@ip

SSH into server

ip a or ifconfig

View IP address


๐Ÿ“ฆ Package Management (Ubuntu)

Command

Description

sudo apt update

Update package list

sudo apt upgrade

Upgrade packages

sudo apt install name

Install package

sudo apt remove name

Remove package


๐Ÿ”ฅ System Services

Command

Description

systemctl status nginx

Check status

systemctl start/stop nginx

Start/stop service

systemctl enable nginx

Start on boot

journalctl -u nginx

View logs


๐Ÿ“„ Log Management

Command

Description

cd /var/log

System logs directory

tail -n 50 file

Last 50 lines

tail -f file

Live log follow

grep "ERROR" file

Filter logs

awk '{print $1}' file

Print 1st column

sed 's/old/new/' file

Replace text

0
Subscribe to my newsletter

Read articles from Dheeraj Parihar directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Dheeraj Parihar
Dheeraj Parihar