Command format: Command Parameter Object
Parameters:
长格式 --help 短格式 -h
Objects: Objects to be processed, directories, users, etc.
1. Help commands
Man command name (used to view command usage and parameters)
Command name--help (used to view command usage and parameters)
2. Common work Order
1) echo for the value after the terminal output string or variable is extracted
2) date Display & set time
Parameters:
%Y 年 %m 月 %d 日 %H 小时 %M 分钟 %S 秒 %j 今年的第几天
For example, to output the current time of year-month-day time: minutes: seconds
`date “+%Y-%m-%d %H:%M:%S”`
Method of setting the time, Format: date–s "20180831 18:00:00"
3) Reboot: restart
4) Poweroff: Shut down the machine
5) wget: Download network files at terminal
wget URL (site link)
Common parameters:
-b 后台下载 -p 下载到指定目录 -t 最大尝试次数 -c 断点续传 -p 下载页面所有内容,所有!! -r 递归下载
6) PS: View system process, main view PID
Parameter:-A shows all processes
-u 用户以及其他详细信息 -x 显示没有控制终端的进程
7) Top: Windows-like Task Manager for dynamic monitoring of system activity, process information
CTRL + C or Q exit
8) Pidof: PID for querying a process
9) Kill: The service that terminates the specified PID, which is the end process under Windows
Killall: Used to terminate a class of services (via service name, e.g. Killall httpd)
3. System Status Detection commands
1) ifconfig: I know it by myself. I don't want to write.
Set IP and Mask:ifconfig eth0 192.168.10.88 netmask 255.255.255.0
Set Gateway:route add default GW 192.168.10.1
Only temporary modification, after restarting the NIC expires
2) Uname: Used to view system kernel and system version, general use Uname–a
or Cat/etc/redhat-release.
3) Uptime: View system Load Information
The lower the load, the better, never more than 5.
4) Free: Used to display current memory consumption
5) Who: View current logged in user
6) Last: System login information
7) History: See the commands you've used
For example, if you want to use the 70th command, you can directly use!70 without copying and pasting
The default stores the last 1000 history commands, which can be changed, vim/etc/profile
To delete a history command method:
1.HISTORY-C: Delete all
2.history-d: Deletes the specified
- Can be flexibly selected to save or not to save, you need to add a parameter under the/etc/profile file: Histcontrol=ignorespace
After the addition, Source/etc/profile, and then each time the command to knock a space bar, then this time the command is not shown in the history
4. Working Directory Toggle Command
1) PWD: View current path
2) CD: Directory switch
3) LS: Displays the files in the current directory
Parameters:-A show all, including hidden files
-l 等同于 ll -d 显示目录
5. Text editing commands
1) Cat: View Plain text file for less content files, using, direct cat filename
Parameter:-N Displays line number
2)
more:适用于查看长文本,显示百分比,向下翻页,但是不能向上翻页 less:适用于查看长文本,显示百分比,可以上下翻页 head:用于查看文件头部,默认前10行 可以用 -n number指定显示多少行 tail:用于查看文件尾部,默认尾10行,可以用 -n number
3) TR: replacement (temporary replacement)
Can be either a single substitution or a range substitution
4) diff: Compare the differences between multiple texts in the unit of behavior
6. File Directory Management commands
1) Touch: Create a blank file
2) mkdir: Create directory
Parameter:-P recursive creation
3) CP: Copy
Use: CP Original File Destination file
4) MV: Mobile
Use: MV Original file Destination file
Both CP and MV can be used to rename
5) RM: Delete (fancy kill: RM–RF/*)
Combination command use
1. Pipe Break: | (Shift+\ (Enter the key above))
Use: Command a| command b
The data on the screen that the command a (previous command) originally outputs is used for command B (the latter command) to execute
2. Wildcard characters:
* (asterisk): Indicates a match of 0 or more characters
? : Matches a single
[0-9]: indicates a match 0-9
[135]: Indicates that only one of the 1,3,5 is matched
[A-Z]: Indicates matching A-Z
3. Transfer characters:
1) Backslash: \ Causes a variable after the backslash to become a simple string
2) Single quote: ' Escape all variables as pure strings
3) Double quotation marks: "" Keep the variable attribute in it, do not escape
4) Anti-quote: "(Tab key above) let the shell command execute intact
Linux Common Command set