System Commands
Essential system administration and monitoring commands
ps - Process Status
Process monitoring and management commands
# Show all processes
ps aux
# Show processes in tree format
ps auxf
# Show processes for current user
ps -u $USER
# Show processes with custom format
ps -eo pid,ppid,cmd,%mem,%cpu --sort=-%cpu
# Show processes by specific user
ps -u root
# Show processes with full command line
ps -ef
# Show processes with threads
ps -eLf
Individual commands:
ps aux
ps auxf
ps -u $USER
ps -eo pid,ppid,cmd,%mem,%cpu --sort=-%cpu
ps -u root
ps -ef
ps -eLf
top/htop - System Monitor
System monitoring and performance analysis
# Interactive system monitor
top
# Show top processes by CPU
top -o %CPU
# Show top processes by memory
top -o %MEM
# Run top in batch mode
top -b -n 1
# Alternative to top (if available)
htop
# Show system load
uptime
# Show system information
uname -a
Individual commands:
top
top -o %CPU
top -o %MEM
top -b -n 1
htop
uptime
uname -a
df/du - Disk Usage
Disk space monitoring and analysis
# Show disk space usage
df -h
# Show disk usage for specific directory
du -h /path/to/directory
# Show disk usage summary
du -sh /path/to/directory
# Show disk usage for all directories
du -h --max-depth=1
# Show largest directories
du -h | sort -hr | head -10
# Show inode usage
df -i
# Show filesystem type
df -T
Individual commands:
df -h
du -h /path/to/directory
du -sh /path/to/directory
du -h --max-depth=1
du -h | sort -hr | head -10
df -i
df -T
free - Memory Usage
Memory usage monitoring and analysis
# Show memory usage
free -h
# Show memory usage in MB
free -m
# Show memory usage continuously
free -h -s 5
# Show memory usage in GB
free -g
# Show detailed memory info
cat /proc/meminfo
Individual commands:
free -h
free -m
free -h -s 5
free -g
cat /proc/meminfo
systemctl - Service Management
System service management and control
# List all services
systemctl list-units --type=service
# Start a service
systemctl start service_name
# Stop a service
systemctl stop service_name
# Restart a service
systemctl restart service_name
# Enable service at boot
systemctl enable service_name
# Disable service at boot
systemctl disable service_name
# Check service status
systemctl status service_name
# Show service logs
journalctl -u service_name
Individual commands:
systemctl list-units --type=service
systemctl start service_name
systemctl stop service_name
systemctl restart service_name
systemctl enable service_name
systemctl disable service_name
systemctl status service_name
journalctl -u service_name
cron - Scheduled Tasks
Scheduled task management and automation
# List current user's crontab
crontab -l
# Edit current user's crontab
crontab -e
# List root's crontab
sudo crontab -l
# Remove current user's crontab
crontab -r
# Crontab format examples:
# * * * * * command
# 0 2 * * * /path/to/backup.sh
# */15 * * * * /path/to/monitor.sh
# 0 0 1 * * /path/to/monthly.sh
Individual commands:
crontab -l
crontab -e
sudo crontab -l
crontab -r
kill/killall - Process Control
Process termination and signal management
# Kill process by PID
kill 1234
# Force kill process
kill -9 1234
# Kill process by name
killall process_name
# Kill all processes by name
killall -9 process_name
# Send signal to process
kill -HUP 1234
# List available signals
kill -l
# Kill processes by pattern
pkill -f "pattern"
Individual commands:
kill 1234
kill -9 1234
killall process_name
killall -9 process_name
kill -HUP 1234
kill -l
pkill -f "pattern"
mount/umount - Filesystem Management
Filesystem mounting and unmounting operations
# List mounted filesystems
mount
# Mount a filesystem
mount /dev/sdb1 /mnt/backup
# Mount with specific options
mount -t ext4 -o rw /dev/sdb1 /mnt/backup
# Unmount filesystem
umount /mnt/backup
# Force unmount
umount -f /mnt/backup
# Show mount options
mount -o remount,rw /mnt/backup
# Mount network filesystem
mount -t nfs server:/path /mnt/nfs
Individual commands:
mount
mount /dev/sdb1 /mnt/backup
mount -t ext4 -o rw /dev/sdb1 /mnt/backup
umount /mnt/backup
umount -f /mnt/backup
mount -o remount,rw /mnt/backup
mount -t nfs server:/path /mnt/nfs