Linux Shell Basics

Source: Internet
Author: User

1.shell (Bourne Agin Shell) is a command parser that provides interaction between the user and the machine, as well as zsh, Ksh

2. Where are the orders that we have knocked on? In the. bash_history file in your home directory, you can save up to 1000 commands that can be viewed by the user History command.

The number of 3.1 is controlled by the environment variable $histsize.

4. Empty the current command history and cannot empty the commands in the configuration file

[Email protected] ~]# history    1  history[[email protected] ~]#

5. The command is not saved directly to the file, saved to the memory, and then saved to the file when we exit the terminal.

6.HISTSIZE environment variable Control command to save the number of bars configuration file in Etc/profile

7. We will change this value to 5000 variable value does not take effect immediately, must be under source to take effect

8. Want to see when the command is executed you can define the environment variable at the current terminal

9. Re-run the history discovery to see the time.

[Email protected] ~]#     1  201712/29 16:15:32 history    2  201712/29 16:19:51 vim/etc/profile    3  201712/29 16:22:32 echo $HISTSIZE     4  201712/29 16:23:10 source/etc/profile    5  201712/29 16:23:20 Echo $HISTSIZE     6  201712/29 16:24:49 history     7  201712/29 16:28:56 histtimeformat= "%y%m/%d%h:%m:% S "    8  

10. If you want to be permanently active, you need to add the environment variable to the/etc/profile file, and then save the/etc/profile file to eject the source.

11. Permanent entry into force

12. Permanently save the command file, execute the command after the user run all the commands will be appended to the form is saved (directly close the terminal will not record the first knock command)

13.!! That's the last command.

14.! n is how many commands to run, N is the number of bars

15.! Word is the execution of a command that starts from the bottom up with the word word beginning

Command completion and aliases

1. Default does not support command generation completion, need to install Bash-completion package, restart the system after the end

[email protected] ~]# Yum install-y bash-completion

2. If the command is too long, you can alias the command, and then execute the restartnet directly.

3. View all alias alias commands

4. A system-configured alias in the. bashrc file in the user's home directory

[[email protected] ~]# vim. BASHRC

5. Other alias configuration under/etc/profile.d/

[Email protected] profile.d]# cd/etc/profile.d/[[email protected] profile.d]# ls256term.csh                   colorls.csh  packagekit.sh          vim.sh256term.sh                    colorls.sh   qt.csh                 vte.shabrt-console-notification.sh  Lang.csh     qt-graphicssystem.csh  which2.cshbash_completion.sh            lang.sh      qt-graphicssystem.sh   which2.shcolorgrep.csh                 less.csh     qt.shcolorgrep.sh                  less.sh      

6. To cancel a custom alias

  

 

Linux Shell Basics

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.