Essential Linux Commands Every Engineer Should Master
This guide compiles the most indispensable Linux commands—from directory and file manipulation, navigation, and text processing to compression, daily system administration, status monitoring, networking, and database access—providing concise examples and practical tips for both beginners and seasoned users.
Linux offers a vast array of commands that can overwhelm beginners; this concise guide highlights the essential commands you need to master for everyday work and internal training.
Directory Operations
Commonly used commands for handling directories and files:
mkdir – create directories
cp – copy files
mv – move or rename files
rm – remove files
# Create directory and parent directories a/b/c/d
mkdir -p a/b/c/d
# Copy folder a to /tmp
cp -rvf a/ /tmp/
# Move file a to /tmp and rename to b
mv -vf a /tmp/b
# Delete everything (dangerous!)
rm -rvf /Navigation
Use these commands to know where you are and where you want to go: ls – list current directory contents ls -l – detailed listing (helps identify the user) pwd – print working directory cd – change directory find – locate files by criteria
Text Processing
Advanced text manipulation skills are valuable; refer to the linked series for the most common vim, sed, and awk techniques.
Viewing Files
To display file contents:
cat – quick view (use Ctrl+C to stop large output)
less – paginated view with search ( / then n / N)
tail – view the last lines; tail -f follows a growing file (e.g., logs)
# Show file size
du -h file
# Show file content
cat fileStatistics
Combine sort and uniq to aggregate data; the example extracts the top 10 IPs by page views from an Nginx log:
# Extract IP column and count occurrences
awk -F"|" '{print $3}' access.log | sort | uniq -c | sort -nk1 -r | head -n10Other Useful Commands
grep – filter content; --color for highlighted matches, -n to show line numbers
diff – compare two files (also used for patching source code)
# Find POST requests in Nginx logs
grep -rn --color POST access.logCompression
Common archive formats and their commands:
.tar – tar.bz2 – bzip2.gz – gzip.zip – unzip.rar – unrar The most frequently used format is .tar.gz (tar archive compressed with gzip).
# Create a tar.gz archive
tar cvfz archive.tar.gz dir/
# Extract a tar.gz archive
tar xvfz archive.tar.gzDaily Operations
mount – mount external devices (USB, ISO, SSD)
chown – change file owner/group
chmod – modify file permissions (e.g., chmod 000 -R / is destructive)
yum – package manager for CentOS (e.g., yum install wget -y)
service / systemctl – manage services (e.g., restart MySQL)
kill – send signals to processes ( -9, -15, -3)
su – switch user (use - for a clean environment)
System Overview
uname -a – kernel and system information
ps -ef | grep java – list processes
top -H -p pid – interactive view of threads
free – memory usage
df -h – disk usage
ifconfig / ip addr – network interfaces
ping – test connectivity
netstat -ant – show active TCP connections
Work‑Common Commands
export – set environment variables (e.g., export PATH=$PATH:/home/xjj/jdk/bin)
whereis – locate binaries
crontab – schedule recurring jobs (e.g., every 10 minutes)
date – display or set system time ( hwclock for hardware clock)
xargs – build and execute command lines from input (e.g., delete all .class files)
# Delete all .class files
find . | grep .class$ | xargs rm -rvf
# Copy all .rmvb files to a directory
ls *.rmvb | xargs -n1 -i cp {} /mount/xiaodianyingNetworking
ssh – remote login (use -v for verbose output, configure tunnels as needed)
scp – copy files or directories over SSH
wget -c – download files with resume support
# Copy a file via scp
scp a.txt 192.168.0.12:/tmp/a.txt
# Recursively copy a directory
scp -r a_dir 192.168.0.12:/tmp/Database Access
Connect to MySQL from the command line: mysql -u root -p -h 192.168.1.2 These commands form a practical toolbox for Linux users, enabling efficient file handling, system monitoring, automation, and troubleshooting.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
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.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
