Get the App
SLTechnology News&Howtos  ›  Servers  › 

How to use all the parameters of the previous command in CentOS

Shulou Source: shulou.com Published: 2022-06-01 22:15:33 09月10日 Update

This article will explain in detail how to use all the parameters of the previous command in CentOS. The content of the article is of high quality, so the editor shares it for you as a reference. I hope you will have a certain understanding of the relevant knowledge after reading this article.

1. Use all the 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! *

two。 Use the last argument of the previous command

Method:! $

ALT +.

ESC +.

The latter two methods will be automatically completed in terminal.

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

Method:! -:

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

4. Use any part of the previous command

Methods: ALT + +.

The parts of the previous command represented by num, starting at 0, for ls-shld hello.txt. ALT + 0mm. It's ls. -1 is shld.

5. Replace a part of the previous command

Method: replace foo with bar

^ Foo ^ bar only replaces one

!!: gs/foo/bar replaces all

6. Previous order

Method:!

More: we often run a lot of very long commands. At this time, you can view the commands through history and then use! (the command number in history).

All the parameters on how to use the previous command in CentOS are shared here. I hope the above can be helpful to you and learn more. If you think the article is good, you can share it for more people to see.

Tags: Command previous method parameter more example content that is article knowledge article part input yes two individual function again can be passed a lot of Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno MySQL Shulou Technology Redmi macOS MariaDB