Shell Foundation One

Source: Internet
Author: User
Tags aliases

Shell Basics

first, what is the shell

1. is a command interpreter that provides interaction between the user and the machine

2. Support for specific syntax, such as logical judgment, looping

3. Each user can have their own specific shell

4. Default to Bash (Bourneagin Shell)

5. There are zsh,ksh, etc.

Ii. History of the Order

1. Command

Save location:/root/.bash_history

[Email protected] ~]# ls/root/.bash_history

/root/.bash_history

[Email protected] ~]# cat/root/.bash_history

Ls

Ls–t

2. Maximum deposit Bar

[Email protected] ~]# echo $HISTSIZE

1000

3.[[email protected] ~]# history–c

Empty the command history in memory, but do not delete the command file, not the configuration file

4. variable histsize

Modified in /etc/profile , effective after Source/etc/profile

5. record when the corresponding command was run

histtimeformat= "%y%m%d%h:%m:%s"

6. permanently save [[email protected]~]# chattr +a ~/.bash_history

Run this command others can only append, do not delete command

7.!! command indicates the execution of the previous instruction

[Email protected] ~]# pwd

/root

[[email protected] ~]#!!

Pwd

/root

8.!n represents the nth instruction in the execution of the command

9. ! Word represents the most recent command in command history that starts with Word

Iii. command Completion and aliases

1. TAB key: AutoComplete has only one command, two knocks: The beginning is the same, followed by multiple parameters

Parameter completion requires installation: Bash-completion

2. Alias aliases give the command a name

3. Each user has their own configuration alias file ~/.BASHRC

4. Scripts such as/ETC/PROFILE.D. BASHRC Define alias Aliases

5. Custom Alisa put to ~/.BASHRC

6. Unalias restartnet command de-defined alias alias


Four, wildcard characters

1. * Indicates a wildcard character

2. LS *.txt indicates that all files of the. txt are listed

3. ls?. TXT denotes an arbitrary character

4. LS [0-9].txt indicates that a character is listed that represents "[" and "]", such as [0-9] can represent any number between 0-9, [a-za-z] can represent any one letter between A-Z and a-Z, the letter is case-sensitive

5. ls {}.txt = matches multiple files contained in parentheses

6. ls [^.txt] means that the matching result is reversed, note that the wildcard must be in [] to make


V. Input/Output redirection

frequently used file redirection commands:
Command >file:standard output redirected to a file,error still output screen
Command >>file:standard output redirected to a file(Append)
Command 1>file1:standard output redirected to a file
Command 2>>file2: Standard error redirected to a file(Append)
Command 1>file 2>&1: Standard output and standard error Redirect to a file together
Command>>file 2>&1:standard output and standard error Redirect to a file together(Append)
Command < File1 >file2: ToFile1as a standard input,File2as standard output
Command <file:inFileas a file standard input
Note: The aboveCommand>file 2>&1can be modified toCommand>file2>>file


Shell Foundation One

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.