In Linux, there are many query commands that can be used to obtain information on various aspects of the system, process, file, network, etc. The following are some common query commands and their detailed usage:
-
man
Command - View help documentation for a command- usage:
man [命令]
- Example:
man ls
- usage:
-
info
Command - View information documentation for a command- usage:
info [命令]
- Example:
info ls
- usage:
-
ps
Command - View information about currently running processes- usage:
ps [选项]
- Example:
ps aux
- usage:
-
top
Command - View system resource usage in real time- usage:
top
- Example: None
- usage:
-
df
Command - View file system disk space usage- usage:
df [选项] [路径]
- Example:
df -h
- usage:
-
du
Command - Estimate disk space usage of a file or directory- usage:
du [选项] [路径]
- Example:
du -sh /home
- usage:
-
ls
Command - List files and subdirectories in a directory- usage:
ls [选项] [路径]
- Example:
ls -l
- usage:
-
find
Command - Find a file or directory in a specified path- usage:
find [路径] [选项] [表达式]
- Example:
find /home -name "example.txt"
- usage:
-
which
command - displays the full path of the command- usage:
which [命令]
- Example:
which gcc
- usage:
-
whereis
Command - Shows the location of binaries, source code, and help pages- usage:
whereis [命令]
- Example:
whereis python
- usage:
-
grep
Command - Search a file for a matching text pattern- usage:
grep [选项] [模式] [文件]
- Example:
grep "error" logfile.txt
- usage:
-
wget
Command - download files or web pages to local- usage:
wget [选项] [URL]
- Example:
wget https://example.com/file.zip
- usage:
-
ping
Command - Test connectivity to host- usage:
ping [选项] [主机名或IP地址]
- Example:
ping google.com
- usage:
-
traceroute
Command - Display the network path of a packet from source to destination- usage:
traceroute [选项] [目标]
- Example:
traceroute google.com
- usage:
The above are just some common query commands. There are many other powerful query commands available in Linux. You can use man
the command to see the complete usage and options of the command.