Advanced instruction
df
Directive: df (view disk space)
Grammar: df-h (Readable Display)
[root@JueChen linux]# df -h Filesystem Size Used Avail Use% Mounted on rootfs 100G 87G 13G 88% / none 100G 87G 13G 88% /dev none 100G 87G 13G 88% /run none 100G 87G 13G 88% /run/lock none 100G 87G 13G 88% /run/shm none 100G 87G 13G 88% /run/user C: 100G 87G 13G 88% /mnt/c D: 61G 27G 34G 45% /mnt/d E: 121G 11G 110G 9% /mnt/e G: 121G 24G 97G 20% /mnt/g H: 106G 55G 52G 52% /mnt/h K: 73G 39G 34G 54% /mnt/k L: 932G 330G 602G 36% /mnt/l
free
Function: View memory usage
Grammar: free -m(-m denotes unit mb)
[root@JueChen linux]# free -m total used free shared buff/cache available Mem: 12203 5076 6895 17 230 6988 Swap: 12691 68 12622
Swap: For temporary memory, temporary disk space can be used as memory when the real memory of the system is not enough.
head
Function: View the first n lines of a file. If n is not specified, the default is to display the first 10 lines.
Syntax: head-n file path, n for numbers
tail
Function: View the content of the last n lines of a file, if not specified, the last 10 lines will be displayed by default.
Syntax: tail -n file path
[root@JueChen linux]# tail head.txt The full documentation for head is maintained as a Texinfo manual. If the info and head programs are properly installed at your site, the command info coreutils 'head invocation' should give you access to the complete manual. GNU coreutils 8.22 October 2018
Function: You can view the dynamic changes of a file by tail instructions
Grammar: tail-f
less
Function: View files, output with less content, press auxiliary function keys (number + return, space + up and down direction keys) to see more.
Syntax: less view file path
wc
Function: Used to statistics file content information (line number, word number, byte number)
Syntax: wc-lwc file paths that need to be counted
- - l Represents the number of rows
- - w denotes the number of words. The number of words is determined by the space.
- - c denotes bytes
[root@JueChen linux]# wc head.txt 60 277 2196 head.txt [root@JueChen linux]# wc -l head.txt 60 head.txt
date
Function: Represents the operation time and date (read, set)
Grammar 1:date
[root@JueChen linux]# date Wed Aug 28 20:05:16 DST 2019
Grammar 2: date +%F
[root@JueChen linux]# date +%F 2019-08-28
Equivalent to date "+%Y-%m-%d"
[root@JueChen linux]# date "+%Y-%m-%d" 2019-08-28
Grammar 3: date "+% F% T"
[root@JueChen linux]# date "+%F %T" 2019-08-28 20:11:49
Grammar 4: Some time before or after acquisition
date -d "-1 day" "+%Y-%m-%d %H:%M:%S"
[root@JueChen linux]# date -d "-1 day" "+%Y-%m-%d %H:%M:%S" 2019-08-27 20:16:28
Optional values for symbols: + (after) before the latter (-)
Unit optional values: day, mouth, year
- % F denotes the full year, month and day.
- % T represents the complete time and seconds
- % Y means four months
- % m Bimonthly
- % d denotes date with leading 0
- % H denotes hours
- % M stands for minutes
- % S denotes the number of seconds
cal instruction
Function: Used to operate the calendar
[root@JueChen linux]# cal August 2019 Su Mo Tu We Th Fr Sa 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
- 3 means last month, this month and next month
[root@JueChen linux]# cal -3 July 2019 August 2019 September 2019 Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa 1 2 3 4 5 6 1 2 3 1 2 3 4 5 6 7 7 8 9 10 11 12 13 4 5 6 7 8 9 10 8 9 10 11 12 13 14 14 15 16 17 18 19 20 11 12 13 14 15 16 17 15 16 17 18 19 20 21 21 22 23 24 25 26 27 18 19 20 21 22 23 24 22 23 24 25 26 27 28 28 29 30 31 25 26 27 28 29 30 31 29 30
Grammar: cal-y
A calendar that represents the output of a specified year.
clear /ctrl+L
Function: Clear the terminal already has commands and results (information)
Note: This command does not really clear the previous information, but hides the previous information to the top.
The Conduit
Pipeline:|
Function: Pipes are generally used for "filtration", "special" and "expansion treatment".
Grammar: Pipeline can not be used alone. It must be used with other commands. It plays a main auxiliary role.
The name of the document containing the letter "y" in the root directory needs to be queried through the pipeline
[root@JueChen //]# ls | grep y sys
For the above commands
- The pipe acts as a demarcation line. The command in front has an output. The output in front is the input in the back, then filters and then outputs.
- grep instructions, mainly for filtering
[root@JueChen //]# ls bin boot dev etc home init lib lib64 media mnt opt proc root run sbin srv sys tmp usr var [root@JueChen //]# ls | wc -l 20