Linux Common shell commands

Source: Internet
Author: User

1, mkdir newdir: New directory

2. Touch filename: New file

3. Vi/vim filename: Edit file

4. grep [-ACIVN] [-A] [-b] [--color=auto] ' Search string | | Regular expression ' filename : A matching row was found from the file and displayed

-A binary file search in text mode

-C Number of statistics

-I ignores case

-V is the flip display

-N Output line number

-A after displays the following lines of the matching row

-B before display the first few rows of a matching row

5, WC [-LWM] : Count the number of rows, words, characters

-L Number of rows

-W Number of words

-M character Count

6. Alias shortname= ' command ' : aliases for commands. such as "Alias Ll= ' Ls-l '.

  such as "LS | Wc–w ": See how many files and folders are in the current directory

7. Du–hs filename: View file size

8, Lsof–i:p ort: View the process of listening to port ports

9, Tcpdump-s 0-i any port 10012 (listening port)-W Luo.cap (package name): Grab Bag

-S 0 length, 0 for maximum 65535

-I listener Port

-W writes the package directly to the file and does not parse and print it out

10. Man command : View the details of the command

11. Cat:

linux Cat command has three main functions: the
1.Linux Cat command displays the entire file at once . $ cat  filename
2.Linux Cat command to create a file from the keyboard . $ cat > FileName (only new files can be created and existing files cannot be edited.) The
3.Linux Cat command merges several files into a single file . $cat   file1   file2 > file
Parameter:
-N or--number the number of lines starting with 1 for all outputs
-B or-- Number-nonblank is similar to-n, except that blank lines are not numbered
-s or--squeeze-blank  when a blank line with more than two consecutive lines is encountered, a blank line that is substituted as a line
-V or--show-nonprinting
Example:
cat-n textfile1 > Textfile2 Add a line number to the Textfile1 file and enter it textfile2 this file
cat-b textfile1 textfile2 >> Textfile3 Add the contents of the Textfile1 and Textfile2 to the textfile3 after adding the line number (blank line not added) to the file.
Example:
cat-n textfile1 > textfile2  Add a line number to the Textfile1 file and enter it in Textfile2 this file
Cat-b textfile1 textfile2 ;> textfile3  Add the contents of Textfile1 and Textfile2 to the textfile3 after adding the line number (blank line not added) to the file.
Cat/dev/null >/etc/test.txt  This is to empty/etc/test.txt archive content
Cat can also be used to make image file.

cat/dev/fd0 > OUTFILE For example, to make a soft disc image file, put the floppy

Cat Img_file >/dev/fd0 Conversely, if you want to write the image FILE to a floppy disk, please call
Note:
1. OUTFILE refers to the image file name of the output.
2. Img_file refers to image FILE.
3. If the device is written back from image file, the device capacity needs to be equivalent.
4. Usually used in the production of the boot magnetic chip.

Linux Common shell commands

Related Article

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.