Linux basic commands (1)

Source: Internet
Author: User

The direction of the arrows is the flow of data,
Number Description: 0 for standard input, 1 for standard correct output, and 2 for standard error output. The 2&1> or 2&1>> indicates that the standard correct output is the same as the standard error output. such as: Cho ' I am studying ' 2&1>>/data/boy
1, < or 0<: Enter the redirect, and then enter the following items into the previous folder. such as:/data/boy < I am studying
2, << or 0<<: Append an input redirect followed by a string, indicating "end of input" or "ctrl+d" to end. such as:/data/boy << I am studying
3, > or 1>: Output redirection, the front with the output to the back of the folder, will clear the original contents of the folder. such as: I am studying >/data/boy
4, > > or 1>>: Append the output redirect, append the preceding thing to the end of the folder, will not clear the original contents of the folder. such as: I am studying >>/data/boy
5, 2>: Error output redirection, the previous command execution error message output to the following folder, will clear the original contents of the folder.
such as: Cho ' I am studying ' 2>/data/boy
6, 2>>: Error append output redirect, the previous command execution error message is appended to the end of the folder, does not clear the original contents of the folder. such as: Cho ' I am studying ' 2>>/data/boy
7. Xargs: Get content from standard input create and execute commands. xargs-n [number] represents the number of n groups. such as: Xargs-n 3 </data/boy
8. rm-f r [file or directory] Delete file or directory F Force mandatory r recursive recursive delete directory careful use, very dangerous, must first backup before deleting!!!
9, Find-type [F (file), D (directory), C (character), B (Block), S (socket)] Find by Type
find-name [file name, directory name] Search by name
10, grep [content]/data/boy only display the contents of the file, others do not show.
grep-v [Content]/data/boy the contents of the file are filtered out and displayed.
grep n1-a N2: In addition to displaying matching N1 rows, the row is also N2 after the line is displayed.
grep n1-b N2: In addition to displaying matching N1 rows, the rows are also displayed before the row N2.
grep n1-c N2: In addition to displaying matching N1 rows, it also shows the rows of N2 rows of the row and feet.
11, SED flow Editor, to achieve the deletion of the text and replace the search.
Sed-i S#old#new#g/data/boy a global replacement for old in/data/boy with new, #表示分隔符, or/@ instead.
-I modify the file content-E to allow multiple modifications.
s represents a find substitution, replaces another character with one character, and uses the G Union to represent the global substitution of the current row.
Sed-n cancels the default output sed p printing, such as: Sed-n ' 20,30p '/data/boy shows/data/boy from 20 to 30 lines.
12, awk filter output content, is a processing language, NR indicates line number. For example, awk ' nr>19&&nr<31 '/data/boy displays 20 to 30 lines of/data/boy.
13, head/data/boy default display the first 10 lines of the file
Head-n/data/boy Displays the first n rows of the file by default
Tail/data/boy displays the following 10 lines of the file by default
Tail-n/data/boy Displays the following n rows of the file by default

Linux basic commands (1)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.