CentOS uses all parameters of the previous command

Source: Internet
Author: User
Reducing keyboard input can greatly improve the efficiency of programmers. the use of shortcut keys is a good example. Programmers often use terminals. Is there a similar & ldquo; shortcut key & rdquo; on the terminal that can improve our efficiency? The programmer's work is often related to the front and back. Therefore, this article demonstrates how to use the previous command to improve work efficiency. 1. use all the parameter methods of the previous command :! * Example: If I use hello.txt and bye.

Reducing keyboard input can greatly improve the efficiency of programmers. the use of shortcut keys is a good example. Programmers often use terminals. Is there a similar "shortcut key" on the terminal that can improve our efficiency? The programmer's work is often related to the front and back. Therefore, this article demonstrates how to use the previous command to improve work efficiency.

 

1. use all parameters of the previous command

Method:! *

Example: If I edit hello.txtand bye.txt, I want to use git add to add these two files. You can use: git add! *

2. use the last parameter of the previous command

Method:! $

ALT +.

ESC +.

The following two methods are automatically completed in terminal.

3. use the part of the last parameter in the previous command

Method:! -:

Example: I personally think this is useful because a lot of options are input in some commands, and the last one is the object that actually works. if you enter the option again, it will be troublesome.

4. use any part of the previous command

Method:ALT + +.

Num indicates the part of the previous command, starting from 0, for ls-shld hello.txt. ALT + 0 +. is ls. 1 is-shld

5. replace a part of the previous command

Method: replace foo with bar

^ Foo ^ bar is replaced with only one

!! : Gs/foo/bar replace all

6. previous command

Method:!!

 

Finally, we recommend a website to learn this. if you encounter a command that requires too many keyboard input, or if you guess there may be a better and more efficient way, you may wish to search for it on this website. in this way, you can accumulate and take some time to get the result: commandlinefu.com.

 

MORE: We often run a lot of long commands. at this time, you can view the command through history and then use it! (Command number in history ).

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.