Linux Basics (ii)

Source: Internet
Author: User

This article also goes on to introduce some common commands about Linux;

1. >: Output REDIRECT Command

  This command is primarily used to redirect command execution results to a file, that is, the execution results should be output to the on-screen directed output to the file for saving. For example:

  

  Note:> Overlay output redirection is saved within the file, >> append output redirection is saved to the file.

  2, | Pipeline

  The pipeline is used primarily to take the output from the left side of the pipeline as the input parameter to the right of the pipeline and execute. For example:

  

That is: pipelines we can understand the real life of the pipe, the pipe of a plug into the other end to take out, here "| "The left and right are divided into two ends, and at the end of the thing (write), and take something (read).

3, Cat view text file content, all output to the screen

4, more split screen display

When viewing content, when the information is too long to be displayed on one screen, a quick scroll screen will appear, so that users cannot see the contents of the file, you can use the more command at a time to display only one page, press

> c.txtmore c.txt

Note: Press the space to turn to the next page, press the Q key to exit the display, press the H key to get help.

  5. ln creates a connection file

ln source file path Connection file path---"Create a hard link

Ln-s source file path link file path----> Create a soft connection, for example:

  

Note: A hard link can only be for files, cannot create hard links to the directory; second, the source files are modified, the hard link files are changed, and vice versa; third, the source file is deleted, the linked file is not affected, and vice versa.

  

Note: A soft connection can also operate on a file or directory; Second, modify the soft connection file, the target file is also changed, and vice versa; third, delete the source file, the connection file is invalid, delete the connection file, the source file is not affected;

This is due to the relationship of the soft-hard connection file to the source file such as:

  6. grep Text Search

  grep searches primarily for the content of the text, or it can match the search, for example:

  

Note:

-N Displays line numbers

-V shows all rows that do not contain matching files (equivalent negation)

-I ignore case

7. Find Files

Find is typically used to search for a qualifying file under a specific directory, or to search for a file that is owned by a particular user. For example:

Note: First, find./-size 10b-size 600b---find files that are larger than 10B and less than 600B in the current directory.

Second, find./-name "[a-z]*"---> refers to a file that starts with a-Z in the current directory

8. Packaging of tar Files

Usually computer files for security cannot be transferred in the form of a folder, and in many cases the data in the computer often needs to be backed up, tar is the most commonly used backup tool in Unix/linux, this command can file a series of files into a large file, you can also unpack the file to recover data.

Common usage: Packaging: TAR-CVF Xxx.tar; unpacking: TAR-XVF xxx.tar-c Test, for example:

  

  

Note: If you unpack to a different folder, add-C and create a folder.

For the package compression of the file, unpack the unpack as follows:

First, for xxx.tar.gz---> Packaging: TAR-ZCVF xxx.tar.gz *.txt unpacking: TAR-ZXVF xxx.tar.gz-c test

Second, for xxx.tar.bz2-to-pack: TAR-JCVF xxx.tar.bz2 *.txt unpacking: TAR-JXVF xxx.tar.bz2-c Test, for example:

  

9, chmod Modify Permissions

  ---Modify the Owner permission G--Modify the group permissions O--and modify other user permissions, for example:

  

Of course, you can also use mathematics to modify the owner, belong to the group, other user rights, the number represents: Readable permissions--4 writable permission--2 Write Execute permission---1, for example:

  

10, sudo-s Switch Administrator rights

  

Note: When we do some operations, the normal user is unable to execute, at this time we need to call out our super user, root user.

Linux Basics (ii)

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.