linux Commands

System Management

systemctl

Control systemd system and service manager.

systemctl

Examples:
Start a service
systemctl start nginx
Check service status
systemctl status nginx
Enable service on boot
systemctl enable nginx

Logging

journalctl

Query and display messages from the journal.

journalctl

Examples:
View recent logs
journalctl -n 50
Follow logs in real-time
journalctl -f
View logs for a specific service
journalctl -u nginx

Process Management

ps

Report a snapshot of the current processes.

ps

Examples:
Show all processes
ps aux
Show processes for a user
ps -u username
Show process tree
ps -ejH
top

Display Linux processes in real-time.

top

Examples:
Start top
top
Show processes for specific user
top -u username

Networking

netstat

Print network connections, routing tables, interface statistics.

netstat

Examples:
Show listening ports
netstat -tlnp
Show all connections
netstat -an
ss

Show socket statistics (modern replacement for netstat).

ss

Examples:
Show listening ports
ss -tlnp
Show all connections
ss -an
iptables

Administration tool for IPv4 packet filtering and NAT.

iptables

Examples:
List all rules
iptables -L -n -v
Allow incoming SSH
iptables -A INPUT -p tcp --dport 22 -j ACCEPT

Storage

df

Show disk space usage.

df

Examples:
Show disk usage in human readable format
df -h
Show inode usage
df -i
du

Estimate file space usage.

du

Examples:
Show directory sizes
du -sh /var/*
Show largest directories
du -sh /* | sort -hr

File Management

find

Search for files in a directory hierarchy.

find

Examples:
Find files by name
find / -name "*.log"
Find files modified in last 7 days
find / -mtime -7
Find and delete old files
find /tmp -mtime +30 -delete

Text Processing

grep

Search for patterns in files.

grep

Examples:
Search for text in files
grep -r "error" /var/log
Search with case insensitive
grep -i "error" file.txt
Show line numbers
grep -n "pattern" file.txt
sed

Stream editor for filtering and transforming text.

sed

Examples:
Replace text in file
sed 's/old/new/g' file.txt
Delete lines containing pattern
sed '/pattern/d' file.txt
awk

Pattern scanning and text processing language.

awk

Examples:
Print specific field
awk '{print $1}' file.txt
Sum values in column
awk '{sum += $1} END {print sum}' file.txt