The bash feature of Linux learning

Source: Internet
Author: User
Tags aliases clear screen

1, command line completion, PATH completion

tab, press two tab to give all the commands of the system

Command completion: Finds the path defined in the PATH environment variable based on the string we give, and more than one press two times tab to give the list, otherwise direct completion

Path completion, completion based on the file name under the starting path we gave


2. Command aliases

Alias can view aliases defined in the system

Alias aliases = command

Remove aliases using Unalias aliases

Aliases defined in the shell take effect only for the current Shell's life cycle, and the valid range of aliases is only the current shell

Use \RM if you want to execute a command itself rather than an alias by using the \ command, such as executing the RM itself instead of the command alias


3. Command replacement

Replace a subcommand in a command with the result of its execution

$ (command) or ' command ' (anti-quote)

For example, create a file with the name $histsize variable value, Touch $ (echo $HISTSIZE) or touch ' echo $HISTSIZE '

BASH-supported quotes

' Anti-quote command replacement '

' Single quote strong reference, do not complete variable substitution

"" Double quote weak reference, you can implement variable substitution


4. File name Wildcard

* matches any character of any length

? Match any single character

[] matches any single character of the specified range

[ABC] matches any of a, B, c

[A-z] matches any one of a-Z letters

[A-z] matches any one of a-Z letters

[0-9] matches any one of 0-9 numbers

[A-za-z] matches any of a-Z, A-Z

[0-9a-za-z] matches any one of 0-9, A-Z, A-Z

[[: Space:]] The first parenthesis represents the match, [: space:] Represents a string

[: Space:] white space characters

[:p UNCT:] Punctuation

[: Lower:] lowercase characters

[: Upper:] Uppercase

[: Alpha:] uppercase and lowercase letters

[:d Igit:] Number

[: Alnum:] numbers and uppercase and lowercase letters

You can view this list using the man 7 glob

[^] matches any single character outside the specified range

Of course there are a lot of things that can't be matched using wildcards, for example, you need to use regular expressions.


5. Command history

History variable histsize record used command, default value is 1000

-N Displays the most recently used n commands

-A Add record

-R reads records but does not add content records

-W Overwrite existing history file

-C Clear Record

!n N of the Execution History command is numbered

!-n execution of the penultimate nth of the historical command

!! Executes the previous command

! String Execution command history the most recent command that starts with a specified string

!$ references the last parameter of the previous command

Esc. (Press ESC to release and then press.) Ditto

ALT +. (Alt and. Simultaneous press) do not support analog terminals ibid.


6. Command line editing

Cursor jump;

Ctrl + A: Jump to the beginning of the line

Ctrl + E: Jump to end of line

Ctrl + u: Delete the cursor to the beginning of the content

Ctrl + k: Delete the contents of the cursor to the end of the line

Ctrl + L: Clear screen

Ctrl + C: interrupt operation

Ctrl + D: Exit shell

This article is from the "Pole Men" blog, please be sure to keep this source http://wtime.blog.51cto.com/8829658/1530368

The bash feature of Linux learning

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.