Online Linux Terminal Logo
OnlineLinuxTerminal
开发者与运维工程师实战参考指南

终极 Linux 命令速查表

精选高密度 Linux 命令手册,涵盖 100+ 核心命令、chmod 八进制权限矩阵、grep 正则过滤与 Bash 快捷键。

Linux 社区2.4k 在线

与真实 Linux 用户交流,学习常用命令并免费获取精美速查表 PDF。

#1. Navigation & Traversal

pwd

Print current working directory absolute path

ls -la

List all files including hidden dotfiles in detailed format

$ ls -la /var/logRun in Sandbox ⚡
cd ..

Navigate up one parent directory level

cd ~

Jump directly to user home directory

tree -L 2

Display directory structure as a visual tree up to 2 levels

which <app>

Locate executable binary path in system PATH

$ which bashRun in Sandbox ⚡

#2. File & Directory Operations

touch <file>

Create empty file or update timestamp

$ touch script.shRun in Sandbox ⚡
mkdir -p <dir>

Create parent and sub-directories in a single command

$ mkdir -p /home/user/projects/webRun in Sandbox ⚡
cp -r <src> <dest>

Copy directory recursively with all subfolders

$ cp -r /home/user/projects /tmp/backupRun in Sandbox ⚡
mv <old> <new>

Move or rename files and directories

$ mv old_name.txt new_name.txtRun in Sandbox ⚡
cat <file>

Concatenate and print file contents to terminal stdout

$ cat /var/log/syslogRun in Sandbox ⚡
head -n 20 <file>

Output first 20 lines of a file

$ head -n 20 /var/log/syslogRun in Sandbox ⚡
tail -n 20 -f <file>

Output last 20 lines and follow live file growth

$ tail -n 20 /var/log/auth.logRun in Sandbox ⚡
wc -l <file>

Count total number of lines in a file

$ wc -l /var/log/syslogRun in Sandbox ⚡

#3. Text Searching & Pattern Filtering

grep -i 'pattern' <file>

Case-insensitive search for string pattern in file

$ grep -i 'error' /var/log/syslogRun in Sandbox ⚡
grep -r -n 'pattern' .

Recursively search all files with line numbers

$ grep -r -n 'TODO' .Run in Sandbox ⚡
find . -name '*.log'

Recursively locate files by wildcard filename pattern

$ find /var/log -name '*.log'Run in Sandbox ⚡
sed 's/old/new/g' <file>

Stream editor search and replace all instances of string

$ sed 's/localhost/127.0.0.1/g' /etc/hostsRun in Sandbox ⚡
awk '{print $1, $3}' <file>

Extract and print specific space-delimited columns

$ awk '{print $1, $3}' /var/log/auth.logRun in Sandbox ⚡

#4. Permissions & Ownership

chmod 755 <script>

Owner: Read/Write/Execute (7); Others: Read/Execute (5)

$ chmod 755 deploy.shRun in Sandbox ⚡
chmod 644 <file>

Owner: Read/Write (6); Others: Read-Only (4)

$ chmod 644 config.txtRun in Sandbox ⚡
chmod 600 <key>

Owner: Read/Write (6); Others: No access (0)

$ chmod 600 id_rsaRun in Sandbox ⚡
chown user:group <file>

Change owner user and group of file or directory

$ chown user:user deploy.shRun in Sandbox ⚡

#5. System, Memory & Processes

top

Interactive real-time process manager and system metrics

ps aux

Snapshot of all active processes running on the OS

free -h

Display total, used, and available RAM in human-readable GB/MB

uname -a

Print Linux kernel version, architecture, and hostname

#6. Archiving & Compression

tar -czvf archive.tar.gz /path

Create gzipped tarball archive of target directory

$ tar -czvf backup.tar.gz /home/user/projectsRun in Sandbox ⚡
tar -xzvf archive.tar.gz

Extract gzipped tarball archive into current directory

$ tar -xzvf backup.tar.gzRun in Sandbox ⚡
gzip <file>

Compress file into .gz format and replace original

$ gzip server.logRun in Sandbox ⚡
gunzip <file.gz>

Decompress .gz file back to original file

$ gunzip server.log.gzRun in Sandbox ⚡

Linux File Permissions & Chmod Matrix

User (Owner), Group, and Others calculated by summing: Read (4), Write (2), and Execute (1).

Octal ModeSymbolicOwnerGroupOthers
755rwxr-xr-xRead/Write/ExecRead/ExecRead/Exec
644rw-r--r--Read/WriteRead-OnlyRead-Only
600rw-------Read/WriteNoneNone

终极 Linux 命令速查表

精选高密度 Linux 命令手册,涵盖 100+ 核心命令、chmod 八进制权限矩阵、grep 正则过滤与 Bash 快捷键。