Third, the advanced instruction
1.df instruction
Role: View disk space
Syntax: # df--h -h shows a display size in the form of a high readability
2.free instruction
Role: View memory usage
Syntax: #Free -m -m view expressed in units of mb
3.head instruction
Role: view a file before n rows, if n is not specified, it defaults to the first ten lines.
Syntax 1: #head -n file path [n] represents a number
4.tail instruction
Role 1: View a file after n rows, if n is not specified, it defaults to ten rows back.
Syntax: # tail -n file path
Role 2: You can dynamically change a file can be viewed through the tail command.
Syntax: # tail -f file path
This command is generally used to view the log system more.
5.less instruction
Action: See file content with a small output, press the auxiliary function key (number + Enter, Space + down arrow keys) for more
Syntax: file path #less need to see
6.wc instruction
Role: statistics file content information (including the number of lines, words, books, bytes)
Usage: #wc -lwc need statistics file path
-l express lines, the number of lines
-w represent words, the number of words in accordance with spaces to determine the number of words
-c represents bytes, the number of bytes
7.data Directive (focus)
Action: represents the operation time and date (read, set)
Syntax 1: #data output in the form of: 2020 March 24 Tuesday 20:45:16
Syntax 2: #data + F.% (Equivalent to #data "% Y-% m-% d ") output form: 2020-03-24
Syntax. 3: #data "% T +% F." (Equivalent to #data "+% Y-% m-% d% H:% M:% S") ( quotes indicate date and hour, minute, so that as a indivisible body) output in the form of: 2020-03-24 20:45:16
Syntax 4: Obtain some time before or after the (backup)
#data -d “-1 day” “+%Y-%m-%d %H:%M:%S”
Alternatively value of the symbol: + (after) / - (before)
Optional value units: day (day), month (May), year (years)
% F: represent a complete date
% T: full representation when minutes and seconds
% Y: represents a four-digit years
% M: represents the two-month (with leading 0)
% D: represents the two-date (with leading 0)
% H: hour (with leading 0)
% M: represents minute (with leading 0)
% S: represents seconds (with leading 0)
8.cal instruction
Role: used to manipulate the calendar
Syntax 1: #cal #cal -1 is equivalent to the output of the direct current month's calendar
Syntax 2: #cal -3 + represents the output last month, this month, next month's calendar +
Syntax 3: #cal -y year represents the output of one calendar year
9.clear / ctrl + L instruction
Action: remove the terminal already exist in the command and the result (information).
Syntax: clear or shortcut key ctrl + L
Note that the command is not really clear information before, but to hide the information before the top, continue to view the previous information through the scroll bar.
10. The duct (important)
Pipe character: |
Role: generally used to "filter", "Special", "expander"
Syntax: pipes can not alone, with some of the instructions must be stated before use with its primary role is to assist role.
Filter Case (100%): need to check out the piping document name contains "y" letter of the root directory.
#ls / | grep y
- Description for the above command: piped as the dividing line, the previous command has a need to enter the rear output, and then filtered, and finally output, simply is the previous output conduit subsequent instruction is input.
- grep command: used to filter
Special Use Case: less to achieve equivalent effect by the method of operation of the pipe (learn)
Before we look at a document by less, can #less path
Now through the pipeline can be so: #cat path | less
Extended Cases: Please use cases currently learned to count the total number of documents in a directory
#ls / | wc -l