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

Source: Internet
Author: User
Tags aliases clear screen touch command

ShellApplication Tips

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:! History The command label listed, 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" #定义别名组合, you must use " " to draw up

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 content 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 failed to execute , the command behind it will be executed.

e.g.

Write Mary

ls | | Pwd

LSKKK | | Pwd

For more information, please refer to another series of blogs-the four-day Shell Programming Series:

http://blog.csdn.net/zjf280441589/article/details/17455515

http://blog.csdn.net/zjf280441589/article/details/17467069

http://blog.csdn.net/zjf280441589/article/details/17487351

http://blog.csdn.net/zjf280441589/article/details/17503985


5. Command substitution

Command 1 ' command 2 '# simplifies the operation by making the output of command 2 a parameter of command 1 .

E.g.ll ' which touch ' # See The details of the touch command

Attached-cat/etc/shells# lists all shells supported by the current system

And the Linux default is bash/bin/bash

A bit older UNIX bin/sh

Attached-WC

Wc-l msg# View msg file content how many lines

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.