[Linux Command sorting 8] alias, input/output redirection, pipeline, command connector, command replacement character

Source: Internet
Author: User

Command 1: alias

An alias is used for convenience. If you have a frequently-used command for a long time, you can set an alias to be equivalent. For example, the default alias of LS-Alf is ll.

 

The alias format is as follows:

Alias alias = command

Alias alias = "command combination"

Alias allows you to view the configured aliases

Unalias alias Delete alias

 

Command 2: Input/Output redirection

Output redirection

Input the result of a command to a file.

For example:

Ls-L/ABC>/ABC. MSG Overwrite

Ls-L/ABC>/ABC. MSG append Does Not Overwrite

 

Input redirection

Wall </abc.txt

 

Error output redirection

Ls/ABC 2> ls. Error

If the execution of LS/ABC is normal, it will not be output to LS. Error.

If the LS/ABC execution fails, for example, the ABC directory does not exist, it will be output to LS. Error.

 

Command 3: MPS queue

Use the result of the previous command as the input of the next command.

For example, if you want to view LS-L/etc, but you want to view too much content by page, you can use the pipeline symbol | in series: ls-L/etc | more

You can set multiple MPs queues.

For example, to view the number of init-related files in LS-L/etc, use LS-L/etc | Gret init | WC-L.

 

Command 4: Command Connector

1. execute commands in sequence and connect

Example: whoami; PWD; Date

 

2. After the previous command is successfully executed, the next command will run & connect

Example: Write Mary </love.txt & RM/love.txt

 

3. If the previous command fails to be executed, the next command will be executed. | connection

Example: Write Mary </love.txt | mail Mary/love.txt

 

Command 5: Command replacement character

Use the execution result of one command as the parameter of another command :''

Example: ls-l 'which Touch'

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.