CentOS using all the parameters of the previous command

Source: Internet
Author: User
Tags centos using git

Reduce keyboard input, can greatly improve the programmer's work efficiency, the use of shortcut keys is a good example. Programmers often use terminals. So is there a similar "shortcut key" on the terminal that can improve our efficiency? The programmer's work is often connected. So, this article shows you how to use the previous command to increase your productivity.

1. Use all parameters of the previous command

Method:!*

Example: If I edit hello.txt and bye.txt, then I want to add these two files using git Add. You can use: Git add!*

2. Use the last parameter of the previous command

Method:!$

ALT +.

ESC +.

Two of the following methods, terminal will be automatically filled

3. Use the part of the previous command except for the last parameter

Method:!-:

Example: Personally think this is more useful, because some commands in the middle will enter a lot of options, the last one is the actual role of the object, if you enter the option again, it will appear troublesome.

4. Use any part of the previous command

Method: ALT + +.

Where Num represents the first of the previous command, starting at 0 for LS-SHLD Hello.txt. ALT +0+. is LS. 1 is-shld.

5. Replace one part of the previous command

Method: replace Foo with bar

^foo^bar replaces only one

!!:gs/foo/bar Replaces all

6. Previous command

Method:!!

MORE: We often run a lot of very long commands, this time, you can view the command through the history, and then use! (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.