This is the 29th day of my participation in the genwen Challenge

wc

Default count of the number of lines/words and bytes in a file

Wc [-] l (lines) [w] (words) [m] - (chars) - c (bytes) file path

Can be used in conjunction with pipes

sort

The sorting

Sort [-r](reverse)[-u](unique)[-f](noCase) File path

Can be used in conjunction with pipes

tr

Document processing tool

Tr [option] [string 1] [string 2]

Common options and parameters are described as follows. -d: Deletes all the input characters in string 1.

Cat/etc/passwd | tr 'a-z' a-z '# replace tr - d' a - b < test. TXT # delete tr 'a-z' a-z '< / etc/passwd # redirectionCopy the code

tar

Tar [option] Compressed file name File or directory

XVF (c:create v:view f:file)

Gz suffix: ZCVF ZXVF z:gzip

Tar CVF/ZCVF a.tar/TMP /a tar XVF/ZXVF a.tar -c/TMP /b (the current directory is the default directory)Copy the code

gzip

Not packaged files (folders) [gz suffix] [-d] (unzip) [-r] (recursive) [v] (view) [-t] (test)

gzip -rv /tmp/a
Copy the code

unzip

Zip suffix [-x](decompress)[-v][-t][-d](specify directory)

unzip -x /tmp/a.zip -d /tmp/bb
Copy the code

cal

If the calendar has only one parameter, it represents the year (1-9999), if there are two parameters, it represents the month and year:

Common parameters:

-m displays the calendar of the previous month, the current month, and the next month. -j displays the days of the current year. -y [year] Displays the calendar of the current yearCopy the code

date

Displays or sets the system date and time. date +%Y-%m-%d

-d< string > Displays the date and time indicated in the string. The string must be surrounded by double quotation marks. -s< string > Sets the date and time according to the string. The string must be surrounded by double quotation marks. -u Displays GMT.%H hours (00-23)
%I hours (12) 00 -
%M minutes (expressed as 00-59)
%S Total number of seconds. The starting time is 1970-01-01 00:00:00 UTC.
%S seconds (expressed in the local idiom)
%A Week.
%A Full name of the week.
%D Date (01-31).
%D Date (including year, month and day)
%M Months (expressed as 01-12).
%Y Indicates the year (00-99).
%Y year (represented by four digits).
Copy the code

Which # Check the command path

Which is the location of a system command in the specified PATH and returns the first search result. Using the which command, you can see whether a system command exists and which location of the command was executed.

-n Specifies the length of the file name. The specified length must be longer than or equal to the longest file name in all files.Copy the code

Whereis # View the command path

The whereis command can only be used to search for program names, and only binary files (parameter -b), man description files (parameter -m), and source code files (parameter -s) are searched. If the argument is omitted, all information is returned. Whereis and Locate are efficient searches based on built-in databases, while Find traverses hard drives to find files.

-b Locates the executable file. -m Locate help files. -s Locates the source code file. -u Searches for all files except executable files, source files, and help files in the default path.Copy the code

grep

Powerful text search command, grep(Global Regular Expression Print) Global Regular Expression search.

Grep works like this: it searches for string templates in one or more files. If the template includes Spaces, it must be referenced, and all strings after the template are treated as filenames. The results of the search are sent to standard output without affecting the content of the original file.

Command format:

Grep [option] the pattern file | dir commonly used parameters:

-A n --after-context Displays n lines after matching characters. -b n --before-context Displays n lines before and after matching characters. -C n --context Displays n lines before and after matching characters -f Reads keywords from the file. -n Displays the number of lines in the file where the matching content resides. -r Recursively searches for foldersCopy the code

awk

AWK is a language for processing text files and is a powerful text analysis tool.

Awk [option] 'script command' filename

The cat filename | awk - F: '{print $n}' cat/etc/passwd | awk - F: '$1} {pirnt awk - F:' {print $n} '/ etc/passwdCopy the code