Linux Shell Application Tips

Source: Internet
Author: User

<span style= "FONT-SIZE:14PX;" >--------------------------------------  Shell application Tips------------------------------------------A command completion: Tab completion shell command two: Clear or ctrl+l clean screen ctrl+u Erase all previous contents of the cursor history List all the commands you've knocked. Name alias definition: Alias View alias COPY=CP the next time you copy the line alias xrm= "rm-r" unalias copy delete alias Input output redirect (very many shell scripts) 0 (stdi n) standard input 0<1 (stdout) standard output 1>2 (stderr) standard error output 2>a:> output redirect Ls-l/tmp >/tmp.msg put the results of the ls-l command into the/TMP/TM P.msg, redirect information to a file more/tmp.msg the contents of the directed file can be knocked after: Data >/tmp.msg you will find that the above redirected content has been overwritten with data >>/tmp. Msg This will append the content to the redirect content above b:< input REDIRECT Wall </ETC/MOTD broadcast file content, MOTD is to broadcast the content in advance written c:2> error output redirection (2> indicates an error) u The SR directory is equivalent to the Windows directory, the core directory of the system cp-r/usr/backup/usr.bak 2>/bak.error Copy directory (2 for execution when command error) example: LS xxxxxxx a nonexistent file ls/xxxxxx X 2> ls.err when the LS command fails, the error message is left in the wrong file inside the pipe explanation: the output of one command to another command, as an input to another command, use the method command 1| command 2| command 2|.....| Command N (multiple commands can be connected) Example: ls-l/etc | More the content pipeline of LS output to more paging view ls-l/etc | grep init pipes The LS command content to grep View init files only Ls-l/etc | grep init | Wc-l See how many (multiple pipe) command connectors are in the ETC directory for the init file 1; Interval commands are executed one at a time 2 && (connecting 2 commands) The execution of the preceding command has a logic and relationship, and only after the previous command of && has been successfully executed, Before you perform the following command 3 | | (Connect 2 commands) The execution of the command has a logical or relationship, only | | After the execution of the preceding command fails, the following command is executed example: 1 pwd; LS; The Data 3 command executes the 2 scene in turn: The machine gives you the technology you like. Write a love letter and delete write mm 

Linux Shell Application Tips

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.