[Shell] basic Shell functions: Historical commands & aliases

Source: Internet
Author: User
Tags clear screen

Bytes --------------------------------------------------------------------------------------------------------

I. History commands

History # view History commands

 

History-C # Clear history commands

 

History-W # exit without waiting. directly write the history commands in the cache to the history command to save the file ~ /. Bash_history

 

Vim/etc/profile # The default history command saves 1000 records. You can modify the histsize to save the number of records (unlimited). The command is saved in ~ /. Bash_history File

 

Call Of History commands:

1. Call up and down arrows

2 .! N # Run the command whose line number is N. The command displayed in History displays the corresponding line number before it.

3 .! His # execute the last command starting with his

 

Command and file completion: Tab

[Email protected] Black Eye poet <www. chenwei. ws> ----------------------------------

Ii. aliases and shortcut keys

Alias Vi = "Vim" # defines the alias, which takes effect temporarily

Alias # view all aliases

 

Command Execution sequence:

First, use the absolute or relative path to execute the command.

Alias for second-order execution

Third, execute bash Internal commands.

Fourth, run the first command in the search order defined by the $ PATH environment variable; echo $ path; you can see the path of a series of commands. The system command does not use the path, this is because the environment variable is set and is automatically searched.

 

Permanent save alias:

Edit the. bashrc file in the home directory and write alias Vi = 'vim.

Vim/root/. bashrc

Vim/home/. bashrc

 

Delete alias:

Unalias VI # unalias alias

 

Common bash shortcut keys:

CTRL + C terminate command

CTRL + l clear screen

CTRL + u command before deleting or cutting the cursor

CTRL + k delete or cut the content after the cursor

CTRL + y paste Ctrl + U or Ctrl + k cut content

CTRL + R search in the History command. After pressing CTRL + R, the search page appears. You only need to enter the search content and search from the history command.

CTRL + D Exit the current terminal (equivalent to Exit)

Bytes ------------------------------------------------------------------------------------------------------

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.