---
title: "Linux Command Cheatsheet - Scenario Command List - AllTools"
description: "AllTools Linux Command Cheatsheet groups file, permission, network and process commands with example flags, so you type with more confidence on a server."
canonical_url: "https://tool.warmday.wang/en/info/linux-cheatsheet"
meta:
  author: AllTools
  keywords: "online tools, AllTools, free online tools, developer tools, image tools, PDF tools, text tools, unit converter, no login, browser-based tools"
  "og:description": "AllTools Linux Command Cheatsheet groups file, permission, network and process commands with example flags, so you type with more confidence on a server."
  "og:image": "https://tool.warmday.wang/img/og-cover.png"
  "og:image:alt": "AllTools Logo"
  "og:image:height": "630"
  "og:image:width": "1200"
  "og:title": "Linux Command Cheatsheet - Scenario Command List"
  "twitter:image": "https://tool.warmday.wang/img/og-cover.png"
---

> Index of every page on this site: [llms.txt](https://tool.warmday.wang/llms.txt)

# **Linux Commands Cheatsheet**

Common Linux commands cheatsheet, categorized browsing by scenario.

### **File Operations **14

`ls -la`List all files (hidden)

`cd <dir>`Change directory

`pwd`Show current path

`cp -r <src> <dest>`Recursively replicate directories

`mv <src> <dest>`Move/Rename Files

`rm -rf <dir>`Force recursive deletion of directories

`mkdir -p <path>`Recursively create directories

`touch <file>`Create an empty file

`ln -s <target> <link>`Create softlink

`find <dir> -name "<pattern>"`Find files by name

`locate <pattern>`Quickly locate file paths

`tree -L 2`Tree Display Catalog Structure

`du -sh <dir>`View Catalog Size

`df -h`View Disk Usage

### **Text Processing **12

`cat <file>`View File Contents

`head -n 20 <file>`View first 20 rows

`tail -f <file>`Real-Time Tracking End of File

`grep -rn "<pattern>" <dir>`Recursive Search Text

`sed -i "s/old/new/g" <file>`Replace text in place

`awk '{print $1}' <file>`Extract first column

`sort -u <file>`Sort and Deduplicate

`uniq -c <file>`Statistical duplicate rows

`wc -l <file>`Number of statistical rows

`diff <f1> <f2>`Compare file differences

`cut -d"," -f1 <file>`Extract columns by separator

`tr "a-z" "A-Z" < <file>`Toggle case

### **Process Management **9

`ps aux`View all processes

`top`Real-time process monitoring

`htop`Enhanced Process Monitoring

`kill -9 <pid>`Force termination process

`killall <name>`Terminate process by name

`bg / fg`Backend/Frontend Switching

`nohup <cmd> &`The background does not hang up

`lsof -i :<port>`View Port Occupancy Process

`nice -n 10 <cmd>`Renice Process

### **Network Tools **11

`ping <host>`Test network connectivity

`curl -O <url>`Download file

`wget <url>`Download file

`ssh user@host`SSH Remote Login

`scp <file> user@host:<path>`Remote copy of files

`netstat -tlnp`View Listening Port

`ss -tlnp`View Listening Ports (New Version)

`nslookup <domain>`DNS query

`dig <domain>`DNS Detail Query

`ifconfig / ip a`View Network Interface

`traceroute <host>`Traceroute

### **Permission Management **6

`chmod 755 <file>`Modify file permissions

`chmod +x <file>`Add Execution Permission

`chown user:group <file>`Modify Document Owner

`umask 022`Set Default Permission Mask

`sudo <cmd>`Execute as Admin

`su - <user>`Switch user

### **Package Management **6

`apt install <pkg>`Install package (Debian/Ubuntu)

`apt update && apt upgrade`Update all packages

`yum install <pkg>`Installation Kit (CentOS/RHEL)

`dnf install <pkg>`Install Package (Fedora)

`pacman -S <pkg>`Install Package (Arch)

`brew install <pkg>`Install package (macOS)

### **Compression/Decompression **8

`tar -czf <a>.tar.gz <dir>`Compress to tar.gz

`tar -xzf <a>.tar.gz`Unzip tar.gz

`tar -cjf <a>.tar.bz2 <dir>`Compressed to tar.bz2

`tar -xjf <a>.tar.bz2`Unzip tar.bz2

`zip -r <a>.zip <dir>`Archive Zip

`unzip <a>.zip`Unzip zip

`gzip <file>`Compress to gz

`gunzip <file>.gz`Unzip gz

### **System Info **8

`uname -a`View System Information

`uptime`View Uptime

`free -h`View Memory Usage

`cat /proc/cpuinfo`View CPU Information

`lsblk`View Block Devices

`mount / umount`Mounting & & Unmounting

`systemctl status <service>`View service status

`journalctl -u <service>`View Service Log

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://tool.warmday.wang/#organization","name":"AllTools","alternateName":"AllTools - 全能工具箱","url":"https://tool.warmday.wang/","logo":{"@type":"ImageObject","url":"https://tool.warmday.wang/img/logo.png","width":512,"height":512}},{"@type":"WebSite","@id":"https://tool.warmday.wang/en#website","url":"https://tool.warmday.wang/en","name":"AllTools","inLanguage":"en","publisher":{"@id":"https://tool.warmday.wang/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://tool.warmday.wang/en?q={search_term_string}"},"query-input":"required name=search_term_string"}},{"@type":"WebPage","@id":"https://tool.warmday.wang/en/info/linux-cheatsheet#webpage","url":"https://tool.warmday.wang/en/info/linux-cheatsheet","isPartOf":{"@id":"https://tool.warmday.wang/en#website"},"inLanguage":"en","name":"Linux Command Cheatsheet - Scenario Command List","description":"AllTools Linux Command Cheatsheet groups file, permission, network and process commands with example flags, so you type with more confidence on a server."},{"@type":"BreadcrumbList","@id":"https://tool.warmday.wang/en/info/linux-cheatsheet#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://tool.warmday.wang/en"},{"@type":"ListItem","position":2,"name":"Reference","item":"https://tool.warmday.wang/en/info"},{"@type":"ListItem","position":3,"name":"Linux Command Cheatsheet","item":"https://tool.warmday.wang/en/info/linux-cheatsheet"}]}]}
```

## Sitemap

See the full [sitemap](https://tool.warmday.wang/sitemap.md) for all pages.
