Linux Common Commands (second Edition)--shell application tips

Source: Internet
Author: User
Tags aliases clear screen

Tips:

1, command completion function: <Tab> key

2, clear screen: ctrl+l

3. Delete all contents before cursor: ctrl+u

4. Command history: Historical

Then:! The command label listed in history, you can execute that command.

Such as:! 188

Also: Press the arrow keys ↑ and ↓ to find previously executed commands.

Key Tips:

1. Command aliases:

Role: Can make the operation easier, commands can be more easily remembered.

Alias: Displays the aliases that have been defined by the system.

Define aliases:

Alias COPY=CP

Alias drm= "RM-RF" #定义别名组合, must be caused by ""

To delete an alias :

Unalias copy

Attached-many times,systems in UNIX systems do not have these aliases set up!

2. Input/Output redirection:

0 (STDIN)-standard input, keyboard ;

1 (STDOUT)-standard output, display ;

2 (STDERR)-standard error output, monitor.

> or >> output redirection

LS-L/tmp > Test.txt//File Original contents empty

LS-L/tmp >> test.txt//Append

< input redirection

Wall < Test.txt//input redirect

2> Error Output redirection

Cp-r/usr/backup/usr.bak 2>/bak.error

3, Pipeline: The output of one command is passed to another command as input to another command.

Ls-l/etc | More

Ls-l/etc | grep init #grep Init/etc/inittab

Ls-l/etc | grep init | Wc-l #wc command is a counter

4. Command connector

1); #用; Each command in the interval is executed sequentially

PWD, ls;d ate

2)&&

Command1 && Command2

Successful execution

Failure does not execute

#前后命令的执行存在逻辑与关系, only the command after && has been successfully executed before it is executed.

e.g.

Write Mary

LS && pwd

LSKKK && pwd

3)| |

Command1 | | Command2

Execution does not execute

Do not perform execution

#前后命令的执行存在逻辑或关系, only | | After the previous command execution fails , the command after it is executed.

e.g.

Write Mary

ls | | Pwd

LSKKK | | Pwd

Linux Common Commands (second Edition)--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.