Operations 46 min read

Master Linux Ops: 50 Essential Commands for Fast Troubleshooting

A comprehensive cheat sheet of 50 essential Linux commands covering system information, file management, process control, network diagnostics, disk utilities, log inspection, performance monitoring, security, and SSH, complete with usage examples, practical scenarios, and best‑practice recommendations for daily operations and incident response.

MaGe Linux Operations
MaGe Linux Operations
MaGe Linux Operations
Master Linux Ops: 50 Essential Commands for Fast Troubleshooting

Linux Operations Essential 50‑Command Quick Reference: Troubleshooting and Daily Ops Manual

Applicable Scenarios & Prerequisites

Applicable Scenarios : Daily operations, fault diagnosis, performance analysis, automation scripts, emergency handling, newcomer training.

Prerequisites :

OS: RHEL/CentOS 7.x‑9.x, Ubuntu 18.04‑24.04

Permissions: Some commands require root or sudo

Tools: Mostly built‑in; a few require installation (package names indicated)

Network: Some commands need network access (e.g., yum/apt)

Command Index

System Information Query (1‑10) : uname, hostname, uptime, last, dmesg, lsb_release, hostnamectl, timedatectl, systemctl

File & Directory Operations (11‑20) : find, locate, tree, stat, file, ln, diff, rsync, scp, tar

Process Management (21‑25) : ps, top, htop, pgrep, pkill

Network Diagnostics (26‑35) : ping, traceroute, ss, netstat, ip, curl, wget, nc, nslookup, dig

Disk & Filesystem (36‑40) : df, du, lsblk, fdisk, mount

Log Viewing (41‑43) : tail, grep, journalctl

Performance Monitoring (44‑47) : iostat, vmstat, sar, free

Security & Permissions (48‑50) : chmod, chown, ssh

Command Details (50 Core Commands)

System Information Query (1‑10)

1. uname – view kernel information

Purpose : Verify kernel version, architecture, hostname.

# Show all information
uname -a
# Show only kernel version
uname -r
# Show architecture
uname -m

Applicable Scenarios : Kernel compatibility checks, 64‑bit verification.

2. hostname – view/set hostname

Purpose : Display or temporarily change the hostname.

# Show hostname
hostname
# Show FQDN
hostname -f
# Temporary change (lost after reboot)
sudo hostname new-hostname
# Permanent change (RHEL/CentOS)
sudo hostnamectl set-hostname new-hostname

Applicable Scenarios : Cluster node configuration, monitoring identifiers.

3. uptime – view system uptime and load

Purpose : Quickly see system start time, current users, load average. uptime Output Explanation : 14:23:01: Current time up 10 days, 3:45: Running time 2 users: Number of logged‑in users load average: 0.52, 0.58, 0.60: 1‑, 5‑, 15‑minute load

Load Thresholds :

Load < CPU cores – normal

Load = CPU cores – full load

Load > CPU cores × 1.5 – overload, investigate

Check CPU cores :

nproc   # or grep -c processor /proc/cpuinfo

4. who / w – view current logged‑in users

Purpose : See who is logged in, login time, source IP.

# Simple list
who
# Detailed view (includes load)
w

Applicable Scenarios : Security audit, abnormal login detection, user activity tracing.

5. last – view login history

Purpose : Review historical logins and reboots.

# Show last 10 logins
last -n 10
# Show specific user history
last root
# Show reboot history
last reboot
# Show failed login attempts
sudo lastb -n 10

Applicable Scenarios : Security incident investigation, login audit.

6. dmesg – view kernel messages

Purpose : Examine kernel boot logs, hardware errors, driver loads.

# All kernel messages
dmesg | less
# Last 20 lines
dmesg | tail -20
# Filter disk errors
dmesg | grep -i "sd\|nvme\|error"
# Filter network info
dmesg | grep -i "eth\|network"
# Real‑time monitoring
dmesg -w

Applicable Scenarios : Hardware fault diagnosis, driver issues, boot failure analysis.

7. lsb_release – view distribution info

Purpose : Show Linux distro name and version.

# Full info
lsb_release -a
# Show only version
lsb_release -r
# If not installed, view files
cat /etc/os-release
cat /etc/redhat-release

8. hostnamectl – detailed host info

Purpose : Display hostname, OS version, kernel, architecture, etc.

hostnamectl

9. timedatectl – view/set time and timezone

Purpose : Show system time, timezone, NTP status.

# View time and zone
 timedatectl
# Set timezone
 sudo timedatectl set-timezone Asia/Shanghai
# Enable NTP sync
 sudo timedatectl set-ntp true

10. systemctl – service management

Purpose : Manage systemd services, view status.

# Check service status
systemctl status nginx
# Start/stop/restart
sudo systemctl start nginx
sudo systemctl stop nginx
sudo systemctl restart nginx
# Reload without downtime
sudo systemctl reload nginx
# Enable at boot
sudo systemctl enable nginx
# List running services
systemctl list-units --type=service --state=running
# Show failed services
systemctl --failed

File & Directory Operations (11‑20)

11. find – powerful file search

Purpose : Locate files by name, type, size, time.

# Case‑insensitive name search
find /var/log -iname "*.log"
# Files larger than 100 MB
find /home -type f -size +100M
# Files not modified in 7 days
find /tmp -type f -mtime +7
# Delete old temporary files (dangerous)
find /tmp -name "*.tmp" -mtime +7 -delete
# Execute a command on matches
find /data -name "*.log" -exec gzip {} \;
# Find empty files/dirs
find /var -type f -empty
find /var -type d -empty
# Exclude a directory
find /var -path /var/lib -prune -o -name "*.log" -print

Applicable Scenarios : Disk cleanup, log archiving, file location.

12. locate – fast file locate

Purpose : Quickly find files using an index database.

# Find a file
locate nginx.conf
# Update the index
sudo updatedb
# Case‑insensitive search
locate -i NGINX.CONF
# Limit result count
locate -n 10 "*.log"

13. tree – display directory tree

Purpose : Visualize directory hierarchy.

# Install if missing
sudo yum install -y tree   # RHEL/CentOS
sudo apt install -y tree   # Ubuntu
# Show two levels
tree -L 2 /etc
# Show directories only
tree -d /var
# Show file sizes
tree -h /data
# Exclude patterns
tree -I "node_modules|.git" /project

14. stat – view detailed file info

Purpose : Show file metadata (timestamps, permissions, inode). stat /etc/passwd Timestamp Explanation :

Access : Last access time (atime)

Modify : Last content change (mtime)

Change : Last metadata change (ctime)

15. file – identify file type

Purpose : Determine actual file type regardless of extension.

file /bin/ls
file nginx.conf
file image.png

16. ln – create links

Purpose : Make hard or symbolic links.

# Symbolic link
ln -s /opt/app/current /app
# Hard link
ln /data/file1 /data/file2
# Overwrite existing link
ln -sf /new/target /existing-link

Soft vs Hard Links :

Soft link : Like Windows shortcut, can cross filesystems, breaks if source removed.

Hard link : Shares inode, cannot cross filesystems, survives source removal.

17. diff – compare file differences

Purpose : Show differences between files or directories.

# Simple diff
diff file1.txt file2.txt
# Side‑by‑side
diff -y file1.txt file2.txt
# Ignore whitespace
diff -w file1.txt file2.txt
# Directory diff
diff -r dir1/ dir2/
# Create patch
diff -u old.conf new.conf > config.patch
# Apply patch
patch old.conf < config.patch

18. rsync – efficient file sync

Purpose : Local or remote incremental backup.

# Local incremental sync
rsync -avz --progress /source/ /destination/
# Push to remote
rsync -avz -e ssh /local/ user@remote:/remote/
# Pull from remote
rsync -avz -e ssh user@remote:/remote/ /local/
# Exclude patterns
rsync -avz --exclude='*.log' --exclude='tmp/*' /src/ /dst/
# Delete extraneous files on target
rsync -avz --delete /src/ /dst/
# Limit bandwidth (KB/s)
rsync -avz --bwlimit=1024 /src/ /dst/
# Resume interrupted transfer
rsync -avzP /src/ /dst/

Key Options : -a: Archive mode (preserve permissions, timestamps, links) -v: Verbose -z: Compress during transfer -P: Show progress + resume

19. scp – SSH file transfer

Purpose : Securely copy files over SSH.

# Upload
scp /local/file.txt user@remote:/path/
# Download
scp user@remote:/path/file.txt /local/
# Recursive directory copy
scp -r /local/dir user@remote:/path/
# Specify port
scp -P 2222 file.txt user@remote:/path/
# Preserve permissions and timestamps
scp -p file.txt user@remote:/path/

20. tar – archive and compress

Purpose : Create and extract archives.

# Create gzip archive
tar czf archive.tar.gz /path/to/dir
# Create bzip2 archive
tar cjf archive.tar.bz2 /path/to/dir
# Extract gzip
tar xzf archive.tar.gz -C /destination/
# Extract bzip2
tar xjf archive.tar.bz2
# List contents without extracting
tar tzf archive.tar.gz
# Exclude files
tar czf backup.tar.gz --exclude='*.log' /data
# Append to uncompressed tar
tar rf archive.tar newfile.txt

Process Management (21‑25)

21. ps – view processes

Purpose : List running processes.

# BSD style
ps aux | less
# System V style
ps -ef | less
# Processes of a specific user
ps -u nginx
# Process tree
ps auxf   # or pstree
# Threads
ps -eLf
# Custom columns, sorted by CPU
ps -eo pid,ppid,cmd,%mem,%cpu --sort=-%cpu | head -10

22. top – real‑time process monitor

Purpose : Live view of system resources and processes.

# Start top
 top
# Sort by CPU (press P)
# Sort by memory (press M)
# Kill a process (press k, then PID)
# Show all CPU cores (press 1)
# Quit (press q)
# Filter by user
 top -u nginx
# Batch mode for output file
 top -b -n 1 > top-output.txt
# Set refresh interval (2 s)
 top -d 2

23. htop – enhanced top

Purpose : Colorful, interactive process monitor (install if needed).

# Install
sudo yum install -y htop   # RHEL/CentOS
sudo apt install -y htop   # Ubuntu
# Run
 htop
# Common keys: F3 search, F4 filter, F5 tree, F6 sort, F9 kill, F10 quit

24. pgrep – find process IDs by name

Purpose : Quickly locate PIDs.

# Find nginx PIDs
pgrep nginx
# Show name with PID
pgrep -l nginx
# Full command line match
pgrep -f "nginx: worker"
# By user
pgrep -u nginx

25. pkill – kill processes by name

Purpose : Terminate processes in bulk.

# Kill all nginx processes
sudo pkill nginx
# Force kill (SIGKILL)
sudo pkill -9 nginx
# Graceful termination (default SIGTERM)
sudo pkill -15 nginx
# Kill all processes of a user
sudo pkill -u alice
# Kill by full command line
sudo pkill -f "java.*tomcat"

Network Diagnostics (26‑35)

26. ping – test connectivity

Purpose : Measure latency and packet loss.

# Continuous ping
ping 8.8.8.8
# Ping 5 times
ping -c 5 8.8.8.8
# Set packet size
ping -s 1000 8.8.8.8
# Timeout 3 s
ping -W 3 192.168.1.1
# Fast interval (0.2 s)
ping -i 0.2 8.8.8.8

27. traceroute – trace route path

Purpose : Show hops to destination.

# Basic trace
traceroute 8.8.8.8
# Use ICMP instead of UDP
traceroute -I 8.8.8.8
# Max hops
traceroute -m 20 8.8.8.8
# No DNS lookup (faster)
traceroute -n 8.8.8.8

28. ss – view socket connections

Purpose : Faster replacement for netstat.

# All TCP connections
ss -t
# Listening ports
ss -tln
# UDP connections
ss -u
# Show process info
ss -tlnp
# Summary statistics
ss -s
# Filter by port
ss -tnlp | grep :80
# Show established connections
ss -t state established
# Top IPs by connection count
ss -tn | awk '{print $5}' | cut -d: -f1 | sort | uniq -c | sort -nr | head -10

29. netstat – traditional network stats

Purpose : View connections, routing, interface stats.

# Listening ports
netstat -tln
# All connections with processes
netstat -tunlp
# Routing table
netstat -rn
# Interface stats
netstat -i
# Continuous display
netstat -c

30. ip – manage interfaces and routes

Purpose : Configure IP, routes, NICs (replaces ifconfig).

# List interfaces
ip addr show   # or ip a
# Show specific NIC
ip a show eth0
# Add temporary IP
sudo ip addr add 192.168.1.100/24 dev eth0
# Delete IP
sudo ip addr del 192.168.1.100/24 dev eth0
# Bring interface up/down
sudo ip link set eth0 up
sudo ip link set eth0 down
# Show routing table
ip route show   # or ip r
# Add static route
sudo ip route add 10.0.0.0/8 via 192.168.1.1 dev eth0
# Delete route
sudo ip route del 10.0.0.0/8
# Show ARP table
ip neigh show

31. curl – HTTP client

Purpose : Test APIs, download files, debug HTTP.

# Simple GET
curl https://api.example.com/users
# Show response headers
curl -I https://example.com
# Save output to file
curl -o output.html https://example.com
# Save with original filename
curl -O https://example.com/file.tar.gz
# POST JSON
curl -X POST https://api.example.com/users \
     -H "Content-Type: application/json" \
     -d '{"name":"alice","email":"[email protected]"}'
# Upload file
curl -F "file=@/path/to/file.txt" https://api.example.com/upload
# Follow redirects
curl -L https://short.url/abc123
# Verbose output
curl -v https://example.com
# Set timeout (5 s connect, 10 s total)
curl --connect-timeout 5 --max-time 10 https://example.com
# Basic auth
curl -u username:password https://api.example.com

32. wget – file download

Purpose : Retrieve files, mirror sites.

# Simple download
wget https://example.com/file.tar.gz
# Resume download
wget -c https://example.com/large-file.iso
# Background download
wget -b https://example.com/file.tar.gz
# Limit speed (500 KB/s)
wget --limit-rate=500k https://example.com/file.tar.gz
# Recursive site download (use with care)
wget -r -np -k https://example.com/docs/
# Download URLs from file
wget -i urls.txt
# Custom User-Agent
wget --user-agent="Mozilla/5.0" https://example.com

33. nc (netcat) – Swiss‑army knife

Purpose : Port scanning, listening, data transfer.

# Test port connectivity
nc -zv 192.168.1.1 22
# Scan port range
nc -zv 192.168.1.1 20-80
# Listen on port 8080
nc -l 8080
# Send data to listener
echo "test message" | nc 192.168.1.1 8080
# Receive file
nc -l 8080 > received-file.tar.gz
# Send file
nc 192.168.1.1 8080 < file.tar.gz
# Simple chat
nc -l 8080   # server
nc 192.168.1.1 8080   # client

34. nslookup – DNS query

Purpose : Retrieve DNS records.

# Basic query
nslookup example.com
# Use specific DNS server
nslookup example.com 8.8.8.8
# MX records
nslookup -query=mx example.com
# NS records
nslookup -query=ns example.com
# Reverse lookup
nslookup 8.8.8.8

35. dig – advanced DNS diagnostics

Purpose : Detailed DNS queries.

# Basic query
 dig example.com
# Short answer only
 dig example.com +short
# MX records
 dig example.com MX
# All records
 dig example.com ANY
# Use specific server
 dig @8.8.8.8 example.com
# Reverse lookup
 dig -x 8.8.8.8
# Trace recursive lookup
 dig example.com +trace

Disk & Filesystem (36‑40)

36. df – view disk space

Purpose : Show filesystem usage.

# Human‑readable
 df -h
# Show filesystem type
 df -hT
# Show inode usage
 df -i
# Filter by type (xfs, ext4)
 df -hT -t xfs
 df -hT -t ext4

37. du – view directory size

Purpose : Summarize space used by files/dirs.

# Total size of a directory
 du -sh /var/log
# Subdirectory sizes (depth 1)
 du -h --max-depth=1 /var | sort -hr
# Exclude patterns
 du -sh --exclude='*.log' /var
# Specific file size
 du -h /var/log/messages
# Grand total of matching files
 du -ch /var/log/*.log | tail -1

38. lsblk – list block devices

Purpose : Show disks, partitions, mount points.

# Basic list
 lsblk
# Show filesystem type
 lsblk -f
# Custom columns
 lsblk -o NAME,SIZE,TYPE,MOUNTPOINT,FSTYPE,UUID

39. fdisk – partition management (MBR)

Purpose : View and edit disk partitions.

# List all disks
 sudo fdisk -l
# Interactive mode for a disk
 sudo fdisk /dev/sdb
# Common commands inside fdisk:
# m – help, p – print table, n – new partition, d – delete, w – write & exit, q – quit without saving

40. mount – mount filesystems

Purpose : Attach or detach filesystems.

# Show current mounts
 mount
# Mount a device
 sudo mount /dev/sdb1 /mnt
# Mount an ISO image
 sudo mount -o loop /path/to/image.iso /mnt
# Remount with new options
 sudo mount -o remount,rw /data
# Unmount
 sudo umount /mnt
# Force unmount (dangerous)
 sudo umount -f /mnt
# Lazy unmount (wait for processes)
 sudo umount -l /mnt

Log Viewing (41‑43)

41. tail – view end of file

Purpose : Show latest log lines, follow in real time.

# Default last 10 lines
 tail /var/log/syslog
# Last 50 lines
 tail -n 50 /var/log/syslog
# Real‑time monitoring
 tail -f /var/log/nginx/access.log
# Follow with line numbers
 tail -fn 100 /var/log/app.log
# Monitor multiple files
 tail -f /var/log/nginx/*.log

42. grep – text search

Purpose : Find matching lines in files.

# Basic search
 grep "error" /var/log/syslog
# Case‑insensitive
 grep -i "error" /var/log/syslog
# Show line numbers
 grep -n "error" /var/log/syslog
# Context lines (3 before/after)
 grep -C 3 "error" /var/log/syslog
# Recursive directory search
 grep -r "database connection" /var/log/
# Exclude matches
 grep -v "debug" /var/log/app.log
# Regex OR search
 grep -E "error|warning|critical" /var/log/syslog
# Count matches
 grep -c "error" /var/log/syslog
# List matching files only
 grep -l "error" /var/log/*.log

43. journalctl – systemd logs

Purpose : View logs of systemd services.

# All logs
 journalctl
# Specific service
 journalctl -u nginx
# Real‑time follow
 journalctl -u nginx -f
# Last 100 lines
 journalctl -n 100
# Today's logs
 journalctl --since today
# Time range
 journalctl --since "2025-10-24 00:00:00" --until "2025-10-24 12:00:00"
# Last hour
 journalctl --since "1 hour ago"
# Kernel logs only
 journalctl -k
# Filter by priority (err and higher)
 journalctl -p err
# Vacuum old logs (keep 7 days)
 sudo journalctl --vacuum-time=7d
# Vacuum by size (keep 1 GB)
 sudo journalctl --vacuum-size=1G

Performance Monitoring (44‑47)

44. iostat – I/O statistics

Purpose : Monitor disk I/O performance.

# Install sysstat package
 sudo yum install -y sysstat   # RHEL/CentOS
 sudo apt install -y sysstat   # Ubuntu
# Show CPU and disk I/O
 iostat
# Refresh every 2 s
 iostat 2
# Extended disk info
 iostat -x 2
# MB units
 iostat -xm 2
# Specific device
 iostat -x /dev/sda 2

Key Metrics : %util: Disk utilization ( >80% indicates I/O bottleneck ) await: Average wait time (ms) r/s and w/s: Reads/writes per second

45. vmstat – virtual memory stats

Purpose : Monitor memory, swap, CPU, I/O.

# Refresh every 2 s
 vmstat 2
# Show 5 samples then exit
 vmstat 2 5
# Detailed memory stats
 vmstat -s
# Disk stats only
 vmstat -d

Output Explanation :

procs -----------memory---------- ---swap-- -----io---- -system-- ------cpu-----
 r  b   swpd   free   buff  cache   si   so   bi   bo   in   cs us sy id wa st
 1  0     0 200000  50000 600000   0   0    5   10  100  150  5  2 92  1  0
r

: Running queue ( >CPU cores → CPU bottleneck ) b: Blocked processes si/so: Swap in/out ( >0 indicates memory pressure ) wa: I/O wait ( >20% → I/O bottleneck )

46. sar – system activity report

Purpose : Collect and analyze historical performance data.

# Real‑time CPU usage
 sar -u 2
# Real‑time memory usage
 sar -r 2
# Real‑time disk I/O
 sar -d 2
# Real‑time network traffic
 sar -n DEV 2
# View today's data (requires sysstat collection)
 sar -u -f /var/log/sysstat/sa$(date +%d)
# View yesterday's data
 sar -u -f /var/log/sysstat/sa$(date -d yesterday +%d)
# Specific time range
 sar -u -s 10:00:00 -e 12:00:00

Enable Data Collection :

# RHEL/CentOS
 sudo systemctl enable sysstat
 sudo systemctl start sysstat
# Ubuntu
 sudo systemctl enable sysstat
 sudo sed -i 's/ENABLED="false"/ENABLED="true"/' /etc/default/sysstat
 sudo systemctl restart sysstat

47. free – memory usage summary

Purpose : Show RAM and swap usage.

# Human‑readable
 free -h
# In MB
 free -m
# Continuous monitoring (2 s interval)
 free -h -s 2
# Show total line
 free -h -t

Output Explanation :

total        used        free      shared  buff/cache   available
Mem:          15Gi        7.5Gi       1.2Gi       500Mi        6.8Gi        7.2Gi
Swap:         4.0Gi          0B       4.0Gi
available

: Real usable memory (includes reclaimable cache) buff/cache: Kernel buffers and cache (can be freed)

Security & Permissions (48‑50)

48. chmod – modify file permissions

Purpose : Set read/write/execute bits.

# Numeric mode (recommended)
 chmod 644 file.txt   # -rw-r--r--
 chmod 755 script.sh  # -rwxr-xr-x
 chmod 600 secret.key # -rw-------
# Symbolic mode
 chmod u+x script.sh   # add execute for owner
 chmod g-w file.txt    # remove write for group
 chmod o=r file.txt    # others read‑only
# Recursive directory change
 chmod -R 755 /var/www/html
# Change only directories
 find /var/www -type d -exec chmod 755 {} \;
# Change only files
 find /var/www -type f -exec chmod 644 {} \;

Permission Digits :

7 (rwx): read, write, execute

6 (rw-): read, write

5 (r-x): read, execute

4 (r--): read only

0 (---): no permission

49. chown – change ownership

Purpose : Modify file owner and group.

# Change owner
 sudo chown alice file.txt
# Change owner and group
 sudo chown alice:devops file.txt
# Change only group
 sudo chown :devops file.txt   # or sudo chgrp devops file.txt
# Recursive change
 sudo chown -R nginx:nginx /var/www/html
# Copy ownership from another file
 sudo chown --reference=file1.txt file2.txt

50. ssh – secure remote login

Purpose : Remote command execution, file transfer.

# Basic login
 ssh [email protected]
# Specify port
 ssh -p 2222 [email protected]
# Run a remote command
 ssh user@remote "df -h"
# Execute local script on remote
 ssh user@remote 'bash -s' < local-script.sh
# SSH tunnel (local port 8080 → remote 80)
 ssh -L 8080:localhost:80 user@remote
# Reverse tunnel (remote 9090 → local 3000)
 ssh -R 9090:localhost:3000 user@remote
# Disable password auth (key only)
 ssh -o PasswordAuthentication=no user@remote
# Jump host
 ssh -J jumphost user@target
# Generate SSH key pair
 ssh-keygen -t rsa -b 4096 -C "[email protected]"
# Copy public key to server
 ssh-copy-id user@remote

Command Combination Practices

1. Quickly find high‑CPU processes

ps aux --sort=-%cpu | head -10
top -b -n 1 | head -20

2. Quickly find high‑memory processes

ps aux --sort=-%mem | head -10

3. Find process using a specific port

sudo ss -tlnp | grep :80
sudo netstat -tlnp | grep :80
sudo lsof -i :80

4. Bulk kill zombie processes

ps aux | grep 'Z' | awk '{print $2}' | sudo xargs kill -9

5. Real‑time network traffic monitoring

iftop   # install if needed
nload   # install if needed
# Native method
watch -n 1 'cat /proc/net/dev'

6. Check disk write speed

dd if=/dev/zero of=/tmp/testfile bs=1M count=1024 oflag=direct

7. Batch check server reachability

for ip in 192.168.1.{1..254}; do
  ping -c 1 -W 1 $ip >/dev/null && echo "$ip alive"
done

8. Quickly clean logs while keeping latest 1000 lines

tail -n 1000 /var/log/app.log > /tmp/app.log.tmp && mv /tmp/app.log.tmp /var/log/app.log

Best Practices

Command Aliases : Add common shortcuts to ~/.bashrc (e.g., alias ll='ls -lh', alias df='df -hT', alias free='free -h').

History Optimization : Increase HISTSIZE, HISTFILESIZE, and enable timestamps in ~/.bashrc.

export HISTSIZE=10000
export HISTFILESIZE=10000
export HISTTIMEFORMAT="%F %T "

Secure Login : Use SSH keys exclusively and disable password authentication.

Log Inspection : Prefer journalctl for system logs; use tail -f for application logs.

Performance Monitoring : Enable sar data collection for historical analysis.

Scripting : Wrap frequent command combos into scripts for efficiency.

Least‑Privilege Principle : Avoid direct root logins; use sudo with limited rights.

Backup Critical Configs : Version‑control or regularly backup files like /etc/fstab and /etc/ssh/sshd_config.

Monitoring & Alerts : Integrate Prometheus + node_exporter for metric collection and set alert thresholds.

Documentation : Maintain a knowledge base of common commands and troubleshooting steps.

operationsCommand Linesystem-administration
MaGe Linux Operations
Written by

MaGe Linux Operations

Founded in 2009, MaGe Education is a top Chinese high‑end IT training brand. Its graduates earn 12K+ RMB salaries, and the school has trained tens of thousands of students. It offers high‑pay courses in Linux cloud operations, Python full‑stack, automation, data analysis, AI, and Go high‑concurrency architecture. Thanks to quality courses and a solid reputation, it has talent partnerships with numerous internet firms.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.