Linux Essentials -06,linux Bash features

Source: Internet
Author: User
Tags clear screen

################################################


Bash and its features

Shell Shell

Clt:sh csh ksh bash tcsh zsh

Relationship between programs and processes: One program, multiple processes

Process: Each process, the current host only has the kernel and the current process

A process is a copy of a program, and a process is an execution instance of a program


User working environment

Bash

Shell and child shell


################################################


Bash supports the following features

1, Command history

2, Pipeline redirection

3, naming aliases

4, command-line editing

5, Command line expansion

6, File name wildcard

7, variable

8, programming



################################################


9, command-line editing


Support Command cursor jump

CTRL + A: Jump to the beginning

Ctrl+e: End of line

Ctrl+u: Deleting the beginning of a line

Ctrl+k: Delete End of line

Ctrl+l: Clear Screen


################################################


10,history

-A: Append to/root/.bash_history

-C: Clear command history

-D: Delete the command at the specified location

-W: Cover/root/.bash_history


Command history Usage Tips

!n: Execute nth in the command history

!-n: Executes the last nth rule in the command history

!: Executes the previous line

!string: Executes the last command in the command line that starts with the specified string

!$: Reference the last parameter of the previous command



################################################


11, Command completion


################################################


12, Catalog completion


################################################


13, Command alias

Alias

[[email protected] ~]# alias

Alias cls= ' Clear '

Alias cp= ' Cp-i '

Alias l.= ' ls-d. *--color=auto '

Alias ll= ' Ls-l--color=auto '

Alias ls= ' ls--color=auto '

Alias mv= ' Mv-i '

Alias rm= ' Rm-i '

Alias Which= ' Alias | /usr/bin/which--tty-only--read-alias--show-dot--show-tilde '


[[email protected] ~]# alias cls= ' Clear '

[[Email protected] ~]# CLS


Cancel Alias

[Email protected] ~]# Ualias CLS


################################################


14, Command replacement $


[[email protected] ~]# echo "It is the Dirctory $ (PWD)"

It is the Dirctory/root


Create Time-named files

[Email protected] ~]# touch/tmp/file-$ (date +%f-%h-%m-%s). txt

[Email protected] ~]# ls/tmp/

File-2016-11-15-19-10-06.txt ssh-igeaz44692 testcp T.txt

Lost+found T1.txt Tmp.txt


################################################


15,bash Supported Quotes

Anti-quote ': command substitution

Double quotation mark "": Weak reference

Single quote ': Strong reference


################################################


16, filename wildcard GLOBBISG

*: Any character of any length

? : Single arbitrary character

[]: matches a single character within a specified range

[Abc],[a-z],[a-z],[0-9],[a-za-z],[0-9a-za-z]

[: space]: white space characters

[:p UNCT:]: Punctuation

[: Lower:]: lowercase letters

[: Upper:]: Uppercase

[: Alpha:]: Uppercase and lowercase letters

[:d Igit:] Number

[: Alnum:]: Numbers and uppercase and lowercase sections

[[email protected] t]# Man 7 glob


[^]: Any character outside of the match range, the key of the keypad number key 6 shift+6



[Email protected] etc]# ls/tmp/t*

/tmp/t1.txt/tmp/test/tmp/test1/tmp/test2/tmp/tmp.txt/tmp/t.txt


/TMP/TESTCP:

Testcp.txt

[Email protected] etc]# ls/tmp/a*

/tmp/atest2

[Email protected] etc]# ls/tmp/b*

/tmp/btest2


################################################


This article is from the "James Zhan Linux Advanced ops" blog, so be sure to keep this source http://jameszhan.blog.51cto.com/10980469/1873258

Linux Essentials -06,linux Bash features

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.