Linux--bash Foundation and characteristics (I.)

Source: Internet
Author: User
Tags aliases clear screen glob

For the overall structure of the operating system, the shell is the closest to the user program, is also the operating system and the user can interact with the program.

The shell in its broadest sense consists of two categories:

Gui:gnome,kde,xfce

Cli:sh,csh,ksh,bash,tcsh,zsh

Root,student

Program: Process

Process: In each process it appears that only the kernel and the current process exist on the current host: no awareness of the existence of other processes

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

User work Bad Environment

Bash:

#

#

Tom,jerry

Shell, child shell

Multiple bash, use Pstree to see a process tree

Exit Shell Use Exit

Bash:

1. Command history, Command completion

2. Piping, redirection

3. Command aliases

4. Command-line editing

5. Command line expansion

6. File name Wildcard

7. Variables

8. Programming

command-line editing:

Cursor Jump:

Ctrl + A: Skip to the beginning of the command

Ctrl + E: Skip to the end of the command line

Ctrl + D: Delete a character after the cursor

Ctrl + u: Delete the cursor to the beginning of the command line

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

Ctrl + L: Clear screen

Command history:

View command history: Historical

-C: Empty command history

-D OFFSET [n]: Delete command at specified position history-d 500 10 Delete 10 command from 500, default is a

-W: Saves the command history to the history file: Hidden files in the user's home directory. Bash_history

Environment variables

Path: Command Search Path

Histsize: Command history buffer size

The use of command history tips:

!n: Executes the nth command in the command history;

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

!! : Execution of the previous order;

!string: The last command in the command history that starts with a string

!$: Reference the last parameter of the previous command

Esc.

Alt +.

Command completion: Search each path specified by the PATH environment variable at the beginning of the string we give the executable file, if the extra one, two times tab, you can give the list, or directly complement the whole

Path completion: Searches for each file name under the starting path we give, and tries to complement the entire

Command aliases:

Alias Cmdalias = ' COMMAND [options] [arguments] '

Aliases defined in the shell are valid only for the current shell life cycle, and the valid range of aliases is only for the current shell process

Unalias Cmdalias Canceling command aliases

\cmd

Command substitution: $ (command), anti-quote: ' command '

To replace a subcommand in a command with the process of executing the result

BASH-supported quotes

": Command substitution

"": weak reference, can implement variable substitution

': Strong reference, do not complete variable substitution

File name wildcard, Glob

*: Any character of any length

? : Any single character

[]: matches any single character within the specified range

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

[: Space:]: white space character

[:p UNCT:]: Punctuation

[: Lower:]: lowercase letters

[: Upper:]: Uppercase

[: Alpha:]: Uppercase and lowercase letters

[:d igit:]: Number

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

# Man 7 Glob

[^]: matches any single character outside the specified range

Practice:
1, create A123, Cd6, c78m, C1 My, m.z, K, 8yu, 789 and other documents; Note that the above files are separated by commas, and the other symbols are part of the file name;

2. Display all files beginning with a or m;
# ls [am]*
3. Display all files containing numbers in the file name;
# ls *[0-9]*

# ls *[[:d igit:]]*
4. Display all files that end with a number and do not contain a blank in the file name;
# ls *[[:space:]]*[0-9]
5. display files with special symbols of non-letters or numbers in the file name;
# ls *[^[:alnum:]]*

Linux--bash Foundation and characteristics (I.)

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.