Operations 51 min read

20 Essential Linux Commands for Ops Engineers: Practical Guide with Examples

This comprehensive guide covers 20 essential Linux commands for system administrators, including file management, process monitoring, network diagnostics, and text processing, with practical examples, common parameters, and safety tips for production environments.

MaGe Linux Operations
MaGe Linux Operations
MaGe Linux Operations
20 Essential Linux Commands for Ops Engineers: Practical Guide with Examples

Background

Linux command line is the most fundamental and efficient tool for operations work. Whether daily inspection, troubleshooting, performance optimization, or service deployment, all rely on proficient mastery of common commands. Many junior engineers face a blank terminal after taking over a server and don't know where to start, or only know a few simple commands and are helpless when encountering complex problems.

This article selects 20 Linux commands with the highest usage frequency and practical value in production environments, covering core scenarios such as file management, process management, network diagnosis, system monitoring, and log analysis. Each command not only explains basic usage but also combines real-world cases to illustrate how to apply them in actual environments, along with common parameter combinations and precautions.

Applicable Scenarios

The content applies to the following audiences and scenarios:

Junior Linux operations engineers

Developers who need to quickly get started with Linux command line

System administrators who need to perform system management and troubleshooting

Job seekers preparing for operations-related technical interviews

DevOps engineers who need to master basic Linux operations

Whether physical machines, virtual machines, containers, or cloud hosts, as long as they run Linux systems, these commands are universal.

Core Knowledge Points

Command Categories

The 20 commands selected in this article are classified by function into the following categories:

File and directory operations: ls, cd, pwd, find, du Text processing: grep, awk, sed, tail Process management: ps, top, kill Network diagnosis: ping, telnet, netstat, ss System information: df, free, uptime Other tools: tar,

curl

Command Learning Principles

Master basic usage first, then delve into advanced features

Focus on remembering the most commonly used parameter combinations

Deepen understanding through practical cases

Learn to read man pages and --help output

Practice more in test environments to avoid misoperations

Security Precautions

Commands involving deletion and overwriting operations need to be used with caution

It is recommended to verify in test environment before production operations

Before batch operations, preview with echo or dry-run mode

Avoid using root user directly to execute high-risk commands

Detailed Explanation of 20 Essential Commands

Command 1: ls - List Directory Contents

Basic Usage

ls [options] [path]

Common Parameters

# Show detailed information
ls -l

# Show hidden files
ls -a

# Human-readable file sizes
ls -lh

# Sort by time
ls -lt

# Sort by file size
ls -lS

# Recursively show subdirectories
ls -R

# Reverse sort
ls -lr

Practical Examples

View the 10 largest files in current directory: ls -lSh | head -11 View the 5 most recently modified files: ls -lt | head -6 Count files in specified directory: ls /var/log | wc -l View directories only (exclude hidden files):

ls -l | grep "^d"

Notes

ls -l

output time is file last modification time (mtime) ls -a shows . and .. two special directories

For symbolic links, ls -l shows the size of the link itself, not the target file size

Command 2: cd - Change Directory

Basic Usage

cd [path]

Common Tips

# Switch to user home directory
cd ~
cd

# Switch to parent directory
cd ..

# Switch to grandparent directory
cd ../..

# Switch to previous directory
cd -

# Switch to root directory
cd /

# Switch to specified user's home directory
cd ~username

Practical Examples

Quickly switch between two directories:

cd /var/log
# Do some operations
cd /etc
# Need to go back to /var/log
cd -

Switch to sibling directory of parent directory:

# Currently in /var/log/nginx
cd ../apache2
# Now in /var/log/apache2

Notes

cd

without parameters equals cd ~ If directory name contains spaces, need quotes or escaping cd - prints the switched directory path

Command 3: pwd - Show Current Working Directory

Basic Usage

pwd [options]

Common Parameters

# Show physical path (resolve symlinks)
pwd -P

# Show logical path (don't resolve symlinks, default)
pwd -L

Practical Examples

Confirm current directory:

pwd
# /home/user/project

Get script directory in scripts:

SCRIPT_DIR=$(cd "$(dirname "$0")" && pwd)
echo "Script located at: $SCRIPT_DIR"

Compare logical and physical paths:

# Assume /opt/app is symlink to /usr/local/myapp
cd /opt/app
pwd -L
# /opt/app
pwd -P
# /usr/local/myapp

Notes

pwd

outputs absolute path

In scripts, pay attention to symlink effects when using

pwd

Command 4: find - Find Files

Basic Usage

find [path] [conditions] [action]

Common Conditions

# Find by filename
find /var/log -name "*.log"

# Find by filename (case insensitive)
find /var/log -iname "*.LOG"

# Find by file type (f=file, d=directory, l=symlink)
find /etc -type f

# Find by file size
find /var/log -size +100M
find /tmp -size -1k

# Find by modification time
find /var/log -mtime -7  # Modified within 7 days
find /tmp -mtime +30     # Modified 30 days ago

# Find by permissions
find /var/www -perm 777

# Find by user
find /home -user nginx

# Find by group
find /var -group www-data

Common Actions

# Show found files (default)
find /var/log -name "*.log"

# Show detailed file info
find /var/log -name "*.log" -ls

# Execute command
find /var/log -name "*.log" -exec ls -lh {} \;

# Delete found files
find /tmp -name "*.tmp" -delete

# Interactive confirmation delete
find /tmp -name "*.tmp" -ok rm {} \;

Practical Examples

Find log files larger than 100MB and sort by size:

find /var/log -type f -size +100M -exec ls -lh {} \; | sort -k5 -hr

Find log files from 30 days ago and delete:

find /var/log -type f -name "*.log.*" -mtime +30 -delete

Find files with 777 permissions and change to 644:

find /var/www -type f -perm 777 -exec chmod 644 {} \;

Find empty directories: find /tmp -type d -empty Find files modified within specific time range:

# Modified within last 24 hours
find /var/log -type f -mtime 0

# Modified 7 to 14 days ago
find /var/log -type f -mtime +7 -mtime -14

Find files containing specific content:

find /etc -type f -name "*.conf" -exec grep -l "server_name" {} \;

Notes

-delete

operation is irreversible; preview with -ls before use -exec uses {} for found files, \; as command terminator -ok confirms each execution; use cautiously for batch operations in production -mtime +30 means 30 days ago, -mtime -7 means within recent 7 days

Large directories may cause find to be slow; watch performance impact

Command 5: du - Check Disk Usage

Basic Usage

du [options] [path]

Common Parameters

# Human-readable sizes
du -h

# Show directory total size
du -sh /var/log

# Show directory sizes at specified depth
du -h --max-depth=1 /var

# Sort by size
du -h /var/log | sort -hr | head -10

# Show each file size
du -ah /var/log

# Show total size
du -ch /var/log | tail -1

Practical Examples

View sizes of first-level directories under root: du -sh /* 2>/dev/null | sort -hr Find top 10 largest directories: du -h /var --max-depth=2 | sort -hr | head -10 Find top 10 largest files: du -ah /var/log | sort -hr | head -10 Count current directory total size: du -sh . Exclude certain directories:

du -sh /var --exclude="*.log"

Notes

du

counts actual disk space occupied

For sparse files, du shows smaller size than ls -l Large directories make du slow; watch performance impact 2>/dev/null ignores permission denied errors

Command 6: grep - Search Text

Basic Usage

grep [options] [pattern] [file]

Common Parameters

# Ignore case
grep -i "error" /var/log/syslog

# Show line numbers
grep -n "error" /var/log/syslog

# Show context lines
grep -A 3 "error" /var/log/syslog  # After 3 lines
grep -B 3 "error" /var/log/syslog  # Before 3 lines
grep -C 3 "error" /var/log/syslog  # Before and after 3 lines

# Recursive directory search
grep -r "server_name" /etc/nginx/

# Show only filenames
grep -l "error" /var/log/*.log

# Show match count only
grep -c "error" /var/log/syslog

# Show non-matching lines
grep -v "INFO" /var/log/app.log

# Use extended regex
grep -E "error|warn|fail" /var/log/syslog

# Use Perl regex
grep -P "\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}" /var/log/access.log

Practical Examples

Find errors in logs and count: grep -i "error" /var/log/app.log | wc -l Search multiple keywords: grep -E "error|warn|fail" /var/log/syslog Extract IP addresses:

grep -oE "\b([0-9]{1,3}\.){3}[0-9]{1,3}\b" /var/log/access.log

Find lines not containing keyword: grep -v "DEBUG" /var/log/app.log Recursively search config files with specific content:

grep -r "listen 80" /etc/nginx/ --include="*.conf"

Combine with pipes: ps aux | grep nginx | grep -v grep Show context of matching lines:

grep -C 5 "OutOfMemory" /var/log/app.log

Notes

grep

uses basic regex by default; some characters need escaping -E uses extended regex, no need to escape +, ?,

|
-P

uses Perl regex, most powerful but not supported on all systems

Recursive search on large directories can be slow grep -v grep commonly filters out grep's own process

Command 7: awk - Text Processing Tool

Basic Usage

awk [options] 'pattern {action}' [file]

Common Scenarios

# Print specific columns
awk '{print $1}' file.txt
awk '{print $1, $3}' file.txt

# Print columns with specific delimiter
awk -F: '{print $1}' /etc/passwd

# Filter rows and print
awk '$3 > 1000 {print $1}' /etc/passwd

# Count lines
awk 'END {print NR}' file.txt

# Sum specific column
awk '{sum += $2} END {print sum}' file.txt

# Format output
awk '{printf "%-10s %s
", $1, $2}' file.txt

Practical Examples

Count status codes in access logs:

awk '{print $9}' /var/log/nginx/access.log | sort | uniq -c | sort -rn

Extract columns 1 and 3: ps aux | awk '{print $1, $3}' Filter processes with CPU > 10%: ps aux | awk '$3 > 10 {print $0}' Calculate column sum:

df -h | awk 'NR>1 {gsub(/%/, "", $5); sum += $5} END {print sum}'

Format output:

awk -F: '{printf "User: %-15s UID: %s
", $1, $3}' /etc/passwd

Handle multiple delimiters: awk -F'[: ]' '{print $1, $3}' file.txt Print lines matching pattern:

awk '/error/ {print $0}' /var/log/app.log

Notes

$0

= whole line, $1 = first column, etc. NR = current line number, NF = number of columns in current line -F specifies delimiter; default is space or tab awk is stream processing, suitable for large files

Command 8: sed - Stream Editor

Basic Usage

sed [options] 'command' [file]

Common Commands

# Replace text (first match per line only)
sed 's/old/new/' file.txt

# Replace all matches
sed 's/old/new/g' file.txt

# Delete lines containing pattern
sed '/pattern/d' file.txt

# Print matching lines
sed -n '/pattern/p' file.txt

# Replace content on specific line
sed '3s/old/new/' file.txt

# Delete empty lines
sed '/^$/d' file.txt

# Insert after matching line
sed '/pattern/a
ew line' file.txt

# Insert before matching line
sed '/pattern/i
ew line' file.txt

# Edit file in-place
sed -i 's/old/new/g' file.txt

Practical Examples

Batch replace strings in config files:

sed -i 's/listen 80/listen 8080/g' /etc/nginx/sites-enabled/*.conf

Delete empty lines from log file:

sed '/^$/d' /var/log/app.log > /var/log/app_clean.log

Extract specific line range: sed -n '10,20p' file.txt Comment out a line in config file: sed -i '5s/^/# /' config.conf Batch modify IP addresses in files:

sed -i 's/192\.168\.1\.10/192.168.1.20/g' *.conf

Insert line at file beginning: sed -i '1i\# Configuration file' config.conf Delete lines containing specific keyword:

sed -i '/DEBUG/d' /var/log/app.log

Notes

-i

modifies file directly; backup before operation -i.bak creates backup before modification

Special regex characters need escaping sed outputs to stdout by default, doesn't modify original file

Command 9: tail - View File End

Basic Usage

tail [options] [file]

Common Parameters

# Show last 10 lines (default)
tail file.txt

# Show last 20 lines
tail -n 20 file.txt
tail -20 file.txt

# Real-time follow new content
tail -f /var/log/syslog

# Show last 100 bytes
tail -c 100 file.txt

# Follow multiple files
tail -f /var/log/nginx/access.log /var/log/nginx/error.log

# Start from line 10
tail -n +10 file.txt

Practical Examples

Real-time monitor log: tail -f /var/log/app.log Real-time monitor and filter specific content: tail -f /var/log/app.log | grep "ERROR" View last 50 lines and search keyword: tail -n 50 /var/log/app.log | grep "timeout" View multiple log files simultaneously: tail -f /var/log/nginx/*.log View last lines of compressed log:

zcat /var/log/syslog.1.gz | tail -20

Notes

tail -f

runs continuously; press Ctrl+C to exit

For rotated logs, tail -f may miss new content; need to re-execute

Some systems support tail -F which auto-detects file rotation

Command 10: ps - View Processes

Basic Usage

ps [options]

Common Parameters

# View all processes
ps aux
ps -ef

# View processes of specific user
ps -u nginx

# View process tree
ps auxf
ps -ejH

# View specific process
ps -p 1234

# View process threads
ps -eLf

# Custom output columns
ps -eo pid,comm,pcpu,pmem

Practical Examples

Find specific process: ps aux | grep nginx Sort by CPU usage: ps aux --sort=-%cpu | head -10 Sort by memory usage: ps aux --sort=-%mem | head -10 View detailed process info: ps -fp $(pgrep nginx) View process start time: ps -eo pid,lstart,cmd Count processes for a user: ps -u www-data | wc -l Find zombie processes:

ps aux | awk '$8 ~ /Z/ {print $0}'

Notes

ps aux

and ps -ef have slightly different output formats but similar info ps shows static snapshot, not real-time updates

Process states: R=Running, S=Sleeping, D=Uninterruptible sleep, Z=Zombie, T=Stopped %CPU and %MEM in ps output are instantaneous values

Command 11: top - Real-time Process Monitoring

Basic Usage

top [options]

Common Shortcuts

# Sort by CPU usage
P

# Sort by memory usage
M

# Sort by running time
T

# Show full command
c

# Kill process
k

# Change refresh interval
d

# Quit
q

# Show only specific user's processes
u

# Show threads
H

Common Parameters

# Batch mode (output to file or pipe)
top -b -n 1

# Show only specific process
top -p 1234

# Specify refresh interval
top -d 2

# Show only specific user's processes
top -u nginx

Practical Examples

View system load:

top
# Check load average on first line

Monitor specific process:

top -p $(pgrep nginx | tr '
' ',' | sed 's/,$//')

Output one snapshot to file: top -b -n 1 > top.txt View thread-level resource usage: top -H -p 1234 Show top 10 CPU-consuming processes:

top -b -n 1 | head -17 | tail -10

Notes

top

defaults to sorting by CPU usage

Third line %Cpu(s) shows CPU state percentages us =user, sy =kernel, id =idle, wa =IO wait top 's %CPU is sum across all cores, may exceed 100%

Command 12: kill - Terminate Processes

Basic Usage

kill [options] [PID]

Common Signals

# Default signal (TERM, 15)
kill 1234

# Force kill (KILL, 9)
kill -9 1234

# Reload config (HUP, 1)
kill -HUP 1234

# Stop process (STOP, 19)
kill -STOP 1234

# Continue process (CONT, 18)
kill -CONT 1234

# List all signals
kill -l

Practical Examples

Kill all nginx processes:

pkill nginx
# Or
killall nginx

Graceful nginx reload: kill -HUP $(cat /var/run/nginx.pid) Kill all processes matching condition:

ps aux | grep "process_name" | grep -v grep | awk '{print $2}' | xargs kill

Kill all processes of specific user: pkill -u username Force kill stuck process:

kill -9 1234

Notes

kill -9

cannot be caught by process; forces termination, may cause data loss

Prefer kill for graceful exit; use kill -9 only if ineffective killall and pkill match by process name; may accidentally kill same-name processes

Killing parent process makes child processes orphans

Command 13: df - Check Disk Space

Basic Usage

df [options] [filesystem]

Common Parameters

# Human-readable
df -h

# Show filesystem type
df -T

# Show inode usage
df -i

# Show only local filesystems
df -l

# Show filesystem containing specified file
df /var/log/syslog

# Show only specific filesystem type
df -t ext4

Practical Examples

Check disk usage: df -h Check root partition usage: df -h / Check inode usage: df -i Sort by usage percentage: df -h | sort -k5 -rh View all ext4 filesystems: df -t ext4 Exclude specific filesystem types:

df -x tmpfs -x devtmpfs

Notes

df

shows filesystem-level usage

If disk 100% full but du doesn't account for it, deleted files may still be held by processes df -i checks inode usage; inode exhaustion also prevents file creation

Repeated mount points affect df display

Command 14: free - Check Memory Usage

Basic Usage

free [options]

Common Parameters

# Human-readable
free -h

# In MB
free -m

# In GB
free -g

# Continuous display
free -s 2  # Refresh every 2 seconds

# Show detailed info
free -w

Practical Examples

View memory usage: free -h Continuous memory monitoring: free -h -s 2 Focus on available memory:

free -h | awk 'NR==2 {print "Available memory: " $7}'

Calculate memory usage percentage:

free | awk 'NR==2 {printf "Memory usage: %.2f%%
", $3/$2*100}'

Notes

available

column is actual available memory, more meaningful than free column buff/cache is system cache, can be reclaimed

High swap usage usually indicates insufficient physical memory

Different free versions may have slightly different output formats

Command 15: uptime - View System Uptime and Load

Basic Usage

uptime

Output Example

14:30:45 up 10 days,  3:21,  2 users,  load average: 2.35, 1.80, 1.50

Field meanings: 14:30:45: Current time up 10 days, 3:21: System uptime 2 users: Current logged-in users load average: 2.35, 1.80, 1.50: 1, 5, 15 minute load averages

Practical Examples

Quick system load check: uptime Get load value in script:

LOAD=$(uptime | awk -F'load average:' '{print $2}' | awk '{print $1}' | sed 's/,//')
echo "1-minute load: $LOAD"

Monitor load changes:

watch -n 5 uptime

Notes

Load average must be judged with CPU core count

Load approaching or exceeding 2x CPU cores needs attention

High load doesn't necessarily mean high CPU; could be IO bottleneck

Command 16: ping - Test Network Connectivity

Basic Usage

ping [options] [target]

Common Parameters

# Send specified packet count
ping -c 4 baidu.com

# Set packet size
ping -s 1000 baidu.com

# Set timeout
ping -W 2 baidu.com

# Set packet interval
ping -i 0.5 baidu.com

# Quiet mode (only statistics)
ping -q -c 10 baidu.com

# Flood mode (send as fast as possible)
ping -f baidu.com  # Requires root

Practical Examples

Test network connectivity: ping -c 4 8.8.8.8 Test gateway connectivity:

ping -c 4 $(ip route | grep default | awk '{print $3}')

Test DNS resolution: ping -c 4 baidu.com Batch test multiple IPs:

for ip in 192.168.1.{1..10}; do
  ping -c 1 -W 1 $ip &>/dev/null && echo "$ip is up" || echo "$ip is down"
done

Test network latency:

ping -c 100 baidu.com | tail -1

Notes

Some servers disable ICMP; ping failure doesn't mean server unreachable

Without -c, ping runs continuously; press Ctrl+C to stop

Firewall may block ICMP packets

High latency variation may indicate network instability

Command 17: telnet - Test Port Connectivity

Basic Usage

telnet [host] [port]

Practical Examples

Test HTTP port: telnet baidu.com 80 Test MySQL port: telnet 192.168.1.10 3306 Test SSH port: telnet 192.168.1.10 22 Test port in script:

timeout 2 telnet 192.168.1.10 80 &>/dev/null
if [ $? -eq 0 ]; then
  echo "Port open"
else
  echo "Port unreachable"
fi

Batch test ports:

for port in 80 443 3306 6379; do
  timeout 1 telnet 192.168.1.10 $port &>/dev/null && echo "Port $port open" || echo "Port $port closed"
done

Notes

After successful connection, press Ctrl+] then type quit to exit

If firewall blocks, telnet hangs

Some systems don't install telnet by default; manual install needed

Recommend using nc or ss instead of telnet for port testing

Command 18: netstat - View Network Connections

Basic Usage

netstat [options]

Common Parameters

# View all connections
netstat -a

# View TCP connections
netstat -t

# View UDP connections
netstat -u

# View listening ports
netstat -l

# View process info
netstat -p

# Don't resolve hostnames
netstat -n

# Common combinations
netstat -antp  # All TCP connections with process and IP
netstat -anlp  # All listening ports

Practical Examples

View all listening ports: netstat -tuln View connections on specific port: netstat -antp | grep :80 Count connections by state:

netstat -an | awk '/^tcp/ {print $6}' | sort | uniq -c | sort -rn

Find IPs with most connections:

netstat -an | grep ESTABLISHED | awk '{print $5}' | awk -F: '{print $1}' | sort | uniq -c | sort -rn | head -10

View process network connections:

netstat -antp | grep nginx

Notes

netstat

replaced by ss on some newer systems -n avoids DNS resolution, faster

Connection states: LISTEN, ESTABLISHED, TIME_WAIT, CLOSE_WAIT, etc.

Many TIME_WAIT connections usually caused by excessive short connections

Command 19: ss - View Socket Statistics

Basic Usage

ss [options]

Common Parameters

# View all connections
ss -a

# View TCP connections
ss -t

# View UDP connections
ss -u

# View listening ports
ss -l

# Show process info
ss -p

# Don't resolve hostnames
ss -n

# Common combinations
ss -antp  # All TCP connections
ss -tulnp  # All listening ports

Practical Examples

View all listening ports: ss -tuln View connections on specific port: ss -antp | grep :80 Count connections by state:

ss -an | awk '{print $2}' | sort | uniq -c | sort -rn

View process connections: ss -antp | grep nginx Find IPs with most connections:

ss -tn | awk 'NR>1 {print $5}' | awk -F: '{print $1}' | sort | uniq -c | sort -rn | head -10

Notes

ss

is faster than netstat; recommended

Output format similar to netstat but not identical

Some systems may not have ss installed by default

Command 20: tar - Archive and Extract Files

Basic Usage

tar [options] [file]

Common Parameters

# Create archive
tar -cvf archive.tar files/

# Create and compress (gzip)
tar -czvf archive.tar.gz files/

# Create and compress (bzip2)
tar -cjvf archive.tar.bz2 files/

# Create and compress (xz)
tar -cJvf archive.tar.xz files/

# Extract
tar -xvf archive.tar

# Extract to specific directory
tar -xvf archive.tar -C /tmp/

# List archive contents
tar -tvf archive.tar

# Append file to archive
tar -rvf archive.tar newfile.txt

# Exclude specific files/directories
tar -czvf archive.tar.gz --exclude="*.log" files/

Practical Examples

Backup directory:

tar -czvf /backup/www_$(date +%Y%m%d).tar.gz /var/www/

Extract to specific directory: tar -xzvf archive.tar.gz -C /opt/ Extract only specific files: tar -xzvf archive.tar.gz file1.txt file2.txt View archive contents: tar -tzvf archive.tar.gz | less Exclude directories when archiving:

tar -czvf backup.tar.gz --exclude="node_modules" --exclude=".git" project/

Split large file archive:

tar -czvf - bigdir/ | split -b 100M - backup.tar.gz.part

Extract split archive:

cat backup.tar.gz.part* | tar -xzvf -

Notes

-c

create, -x extract, -t list; cannot be used simultaneously -z gzip, -j bzip2, -J xz

No need to specify compression format when extracting; tar auto-detects -v shows verbose output; omit for large files to improve speed

Use relative paths when archiving to avoid overwriting system files on extract

Command 21: curl - Send HTTP Requests (Supplementary Command)

Basic Usage

curl [options] [URL]

Common Parameters

# Send GET request
curl http://example.com

# Send POST request
curl -X POST http://example.com

# Send POST data
curl -X POST -d "key=value" http://example.com

# Send JSON data
curl -X POST -H "Content-Type: application/json" -d '{"key":"value"}' http://example.com

# Set request header
curl -H "Authorization: Bearer token" http://example.com

# Save response to file
curl -o output.txt http://example.com

# Download file
curl -O http://example.com/file.tar.gz

# Show response headers
curl -I http://example.com

# Follow redirects
curl -L http://example.com

# Set timeout
curl --connect-timeout 5 --max-time 10 http://example.com

# Ignore SSL certificate verification
curl -k https://example.com

# Show verbose debug info
curl -v http://example.com

Practical Examples

Test API endpoint: curl -X GET http://api.example.com/users Send JSON request:

curl -X POST \
  -H "Content-Type: application/json" \
  -d '{"username":"admin","password":"123456"}' \
  http://api.example.com/login

Download file: curl -O http://example.com/file.tar.gz Test website response time:

curl -o /dev/null -s -w "Time: %{time_total}s
" http://example.com

Batch test multiple URLs:

for url in url1 url2 url3; do
  curl -o /dev/null -s -w "$url: %{http_code} %{time_total}s
" $url
done

Upload file:

curl -F "file=@/path/to/file" http://example.com/upload

Notes

-d

sends POST data with default Content-Type application/x-www-form-urlencoded Sending JSON requires manual Content-Type specification -k ignores SSL verification; only for testing, not recommended for production -L follows redirects; some APIs may require this

Summary

The 20 Linux commands selected in this article cover the most common scenarios in operations work, from file management, text processing, process management to network diagnosis and system monitoring. These commands are essential skills for every operations engineer.

Learning Recommendations

Master basic usage first, then gradually advance to advanced features

Practice extensively in test environments to avoid misoperations

Learn to read man pages and --help output

Understand the principles behind commands rather than rote memorization

Apply flexibly in real-world scenarios

Advanced Directions

Learn Shell scripting to automate command combinations

Learn regular expressions to enhance text processing capabilities

Learn performance analysis tools such as strace, perf, sar Learn container and orchestration tools like Docker, Kubernetes

Learn monitoring and log analysis tools like Prometheus, ELK

Mastering these commands is only the first step; true capability improvement comes from practical accumulation in production environments and deep understanding of system principles.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

monitoringOperationsLinuxtroubleshootingshellsystem-administrationbashcommands
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.