Lesson 22nd Basics of Shell

Source: Internet
Author: User

First, Shell introduction
1, the shell is a command interpreter, providing users and machines to interact, each user can have their own specific shell,
2, CentOS7 default shell for bash, and Zsh,ksh they have the difference in detail,
We can check if the Zsh:yum list |grep is present in the system zsh

What are the features of bash?

Ii. Command History
1, its storage file is:/root/.bash_history
2, when we exit the terminal, it will be stored in the above file.
Its configuration file is:/etc/profile, if you modify the file inside, do not want to quit the terminal to take effect
Run command: Source/etc/profile then use the command to see if it works: Echo $HISTSIZE
3. Change the historyntnt attribute, such as increasing the recording time:
histtimeformat= "%y/%m/%d%h:%m:%s"
1. Use Vim editor/etc/profile to put histtimeformat= "%y/%m/%d%h:%m:%s" variable under variable histsize
Then save the exit,

2, let our command history to save forever, give it a permission to add a: chattr +a/root/.bash_history, and then use lsattr to see it
3 、!! Last command
4,!n (n is a number) For example, you want to run the 66 command:!66
5.!echo it will finally find the command that starts with echo from the history command

Iii. command Completion and aliases
1, Tab hit a complete, knock two (in CENOS6 not support command parameter completion, in CENTOS7 is support Command parameter completion)
2, for example we want to let Systemctl restart Network.service we need to install package: Yum install-y bash-completion, restart:
3, we can make the above command alias: Alias restartnet= "systemctl Restart Network.service"

Four, wildcard characters
1, under Bash, we can use "*" to match multiple characters, with? Matches one character.

V. Input/Output redirection
1. Enter the redirect command:<
2. Output REDIRECT command: >
3. Error REDIRECT command: 2>
4. Append REDIRECT Command:>>

Lesson 22nd Basics of Shell

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.