🐧

Linux Commands Reference

Comprehensive reference guide for common Linux commands. Search and browse Linux commands with descriptions, usage examples, and syntax.

Linux Commands Reference
File Operations16
CommandUsage
ls [options] [directory]
List directory contents, common options: -l detailed list, -a show hidden files, -h human-readable size
ls [options] [directory]
cd [directory]
Change directory, cd ~ go to home, cd .. go up, cd - go to previous directory
cd [directory]
pwd
Print working directory - display full path of current directory
pwd
cp [options] source destination
Copy files or directories, -r recursive copy, -p preserve attributes
cp [options] source destination
mv [options] source destination
Move or rename files/directories
mv [options] source destination
rm [options] file
Remove files, -r recursive delete, -f force, -i interactive
rm [options] file
mkdir [options] directory
Create directories, -p create parent directories
mkdir [options] directory
rmdir [options] directory
Remove empty directories
rmdir [options] directory
touch [options] file
Create empty file or update file timestamp
touch [options] file
cat [options] file
Display file contents, -n show line numbers, -b number non-blank lines
cat [options] file
more [options] file
Display file contents page by page, press space to scroll
more [options] file
less [options] file
Display file contents page by page with scroll support, more powerful than more
less [options] file
head [options] file
Display first lines of file, default 10 lines, -n specify number
head [options] file
tail [options] file
Display last lines of file, default 10 lines, -f follow file changes
tail [options] file
find [path] [options] [expression]
Search for files, -name by name, -type by type, -size by size
find [path] [options] [expression]
grep [options] pattern file
Search for text patterns in files, -r recursive, -i ignore case, -n show line numbers
grep [options] pattern file
Text Processing7
CommandUsage
sed [options] 'command' file
Stream editor for text substitution, deletion, insertion, and more
sed [options] 'command' file
awk [options] 'program' file
Text processing tool with pattern matching and data extraction
awk [options] 'program' file
sort [options] file
Sort lines of file, -r reverse, -n numeric sort, -u unique
sort [options] file
uniq [options] file
Remove or display duplicate lines, -c count, -d show duplicates only
uniq [options] file
cut [options] file
Extract columns from file, -d delimiter, -f fields
cut [options] file
wc [options] file
Count lines, words, characters in file, -l lines, -w words, -c characters
wc [options] file
diff [options] file1 file2
Compare two files and show differences, -u unified format
diff [options] file1 file2
System Information10
CommandUsage
ps [options]
Display process status, aux show all processes, -ef full format
ps [options]
top [options]
Display real-time process and system resource usage
top [options]
htop
Interactive process viewer with better UI than top
htop
df [options]
Display filesystem disk space usage, -h human-readable
df [options]
du [options] [directory]
Display disk usage of directories/files, -h human-readable, -s summary
du [options] [directory]
free [options]
Display memory usage, -h human-readable, -m show in MB
free [options]
uname [options]
Display system information, -a show all
uname [options]
whoami
Display current logged-in username
whoami
id [options] [user]
Display user ID and group ID information
id [options] [user]
uptime
Display system uptime and load average
uptime
Network Operations10
CommandUsage
ping [options] host
Test network connectivity, -c count, -i interval
ping [options] host
curl [options] URL
Transfer data command-line tool, supports HTTP, FTP and more
curl [options] URL
wget [options] URL
Download files from network with resume support
wget [options] URL
netstat [options]
Display network connections, routing tables, interface info, -tuln show listening ports
netstat [options]
ss [options]
Display network connections, faster and more modern than netstat
ss [options]
ifconfig [options] [interface]
Configure and display network interface information
ifconfig [options] [interface]
ip [options] object command
Show and manipulate routing, network devices, interfaces and tunnels, modern replacement for ifconfig
ip [options] object command
traceroute [options] host
Trace the route packets take to reach destination host
traceroute [options] host
nslookup [options] domain
Query DNS records to get IP address for domain
nslookup [options] domain
dig [options] domain
DNS lookup utility, more powerful than nslookup
dig [options] domain
Permission Management4
CommandUsage
chmod [options] mode file
Change file/directory permissions, supports numeric (755) and symbolic (u+x) modes
chmod [options] mode file
chown [options] user:group file
Change file/directory owner and group, -R recursive
chown [options] user:group file
chgrp [options] group file
Change file/directory group ownership
chgrp [options] group file
umask [mode]
Set default file creation permission mask
umask [mode]
Compression & Archive4
CommandUsage
tar [options] file
Archive and extract files, -c create, -x extract, -z gzip, -f filename
tar [options] file
gzip [options] file
Compress files, creates .gz files, -d decompress
gzip [options] file
zip [options] archive file
Create ZIP archives, -r recursive
zip [options] archive file
unzip [options] archive
Extract ZIP files, -l list contents, -d destination
unzip [options] archive
Process Management6
CommandUsage
kill [options] PID
Terminate process, -9 force kill, -15 graceful (default)
kill [options] PID
killall [options] process_name
Kill all processes matching process name
killall [options] process_name
nohup command [args]
Run command immune to hangups, continues running after terminal closes
nohup command [args]
bg [job_number]
Send job to background
bg [job_number]
fg [job_number]
Bring background job to foreground
fg [job_number]
jobs [options]
Display list of jobs in current shell
jobs [options]

What is Linux Commands Reference

Linux commands are text-based instructions executed in a terminal or shell environment to perform various system operations, file management, process control, and system administration tasks. Common Linux commands include file operations (ls, cd, cp, mv), text processing (grep, sed, awk), system information (ps, top, df), and network operations (ping, curl, wget). Understanding Linux commands is essential for system administration, development, and automation tasks.

Features

🐧

Complete Command Reference

Comprehensive list of common Linux commands with detailed descriptions and usage examples
🔍

Search and Filter

Quickly search and filter commands by name, description, or category
📋

Copy Commands

One-click copy commands for easy use in terminal
📚

Organized by Category

Commands organized by category for easy browsing and reference
🎯

Use Cases

🎯

System Administration and Maintenance

Use ps, top, df, du commands to monitor system resources, systemctl to manage services, crontab to schedule tasks, ensuring server stability and performance.
💼

File Search and Processing

Use find to locate files, grep, sed, awk to process text data, tar, zip to compress and backup important files, improving work efficiency.
🏢

Network Troubleshooting

Use ping, traceroute to test network connectivity, netstat, ss to check port usage, curl, wget to download files, quickly identify network issues.
👥

Development Debugging and Log Analysis

Use tail -f to view logs in real-time, grep to filter key information, diff to compare code differences, chmod, chown to set file permissions, enhancing development efficiency.

📋Usage Guide

1️⃣
Step 1
Browse or search for the command you need.
2️⃣
Step 2
Click the copy icon to copy the command.
3️⃣
Step 3
Paste and use the command in your terminal.

📚Technical Introduction

🔧Shell Command Execution Mechanism

Linux commands are executed through Shell interpreters (like Bash, Zsh). The Shell reads user input, parses commands and arguments, locates executables (via PATH environment variable), creates child processes to execute commands, and returns results. Commands can be built-ins (cd, echo) or external programs (ls, grep). Pipes (|) and redirection (>, >>, <) allow data flow between commands, enabling powerful command composition.

📁File System Permission Model

Linux uses a three-tier permission model (rwx: read, write, execute) based on user, group, and others. Each file/directory has owner, group, and permission bits. chmod uses octal (755) or symbolic (u+x) modes. SUID, SGID, and Sticky bits provide special permission control. ACL (Access Control List) offers finer-grained management. Permission check order: owner > group > others, stops at first match.

🌐Process and Job Control

Linux process management is based on process tree structure, with init/systemd as root. ps shows process snapshots, top/htop monitors in real-time. Processes are controlled via signals (SIGTERM, SIGKILL). Foreground processes occupy terminal, background processes (&) run in background. Job control (jobs, fg, bg) manages shell jobs. nohup and screen/tmux allow processes to continue after terminal closes. Inter-process communication (IPC) includes pipes, signals, shared memory.

🔍Text Processing Toolchain

Linux text processing follows Unix philosophy: each tool does one thing well, combined via pipes for complex tasks. grep uses regex pattern matching, sed performs stream editing (substitute, delete, insert), awk is powerful text processing language (field splitting, pattern matching, calculation). sort sorts, uniq removes duplicates, cut extracts columns, wc counts. These tools combine effectively, e.g., 'grep pattern file | sort | uniq' for search, sort, and deduplication.

Frequently Asked Questions

What's the difference between Linux commands and Windows commands?

Linux commands are Unix-based, executed primarily through terminal, concise and efficient, support pipes and redirection. Windows commands (CMD/PowerShell) have different syntax, relatively limited functionality. Linux commands focus more on text processing and composition, while Windows relies more on GUI. Most Linux commands work on macOS and WSL (Windows Subsystem for Linux).
💬

How to learn Linux commands?

Start with basic file operations (ls, cd, cp, mv), gradually learn text processing (grep, sed, awk), system administration (ps, top, df), and network operations (ping, curl). Use 'man command' to view manual, '--help' for help. Practice frequently, combine commands, understand pipes and redirection. Online tools and reference manuals are recommended.
🔍

What to do when Linux command fails?

When command fails, first check error messages. Common causes: insufficient permissions (use sudo or check file permissions), command not found (check PATH or install package), wrong parameters (use man for correct usage), file not found (check path). Use 'which command' to find location, 'type command' to see command type. Check system logs (/var/log/) for more information.
💡

How to improve Linux command efficiency?

Efficiency tips: use Tab for autocomplete, history commands (history, Ctrl+R), create aliases, write Shell scripts for automation, use pipes to combine commands, master shortcuts (Ctrl+C interrupt, Ctrl+D exit, Ctrl+L clear). Use tools like tmux/screen for multiple sessions, fzf for fuzzy search, configure .bashrc or .zshrc for custom environment.
📚

When are Linux commands most useful?

Linux commands are especially useful for: server management and monitoring (system resources, log analysis), development debugging (code search, text processing, version control), automation scripts (batch processing, scheduled tasks), network troubleshooting (connectivity tests, port checks), data processing and analysis (text extraction, statistics), system maintenance (backup, cleanup, permission management). Mastering Linux commands is essential for DevOps, system administrators, and developers.

💡How To & Tips

💡

How to Find Large Files

Use 'find /path -type f -size +100M' to find files larger than 100MB, or 'du -h | sort -h | tail' to see directories using most space.
💡

How to Batch Rename Files

Use 'rename' command or 'for file in *.txt; do mv "$file" "${file%.txt}.bak"; done' to batch rename files.
💡

How to Check Port Usage

Use 'netstat -tuln | grep port' or 'ss -tuln | grep port' to check port usage, 'lsof -i :port' to see specific process.
💡

How to Set Up Scheduled Tasks

Use 'crontab -e' to edit cron jobs, format: minute hour day month weekday command. Use 'crontab -l' to list current jobs.
💡

How to View Real-time Logs

Use 'tail -f /var/log/file.log' to view logs in real-time, 'grep -i error /var/log/file.log | tail -20' to see recent errors.

User Comments

0 / 2000
Loading...