Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Summary of the use of exclamation point command (!) in linux

2025-02-21 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

Preface

Recently, the company configured mbp, usually used more ssh, is really too lazy to write those complex commands, found a command on the Internet, feel more suitable for themselves.

'!' Symbols can be used not only as negative symbols in Linux, but also to retrieve commands from historical command records or to run commands before execution without modification.

The following article will give you a detailed introduction to the use of the linux exclamation mark command (!). Let's take a look at the detailed introduction.

Exclamation mark command usin

Double exclamation point!

!! Represents the last command entered and can be combined with other commands to form a new command

Eg: $. / startup.sh $cat!

This command is equivalent to cat. / startup.sh, eliminating switching back and forth

! $

Represents the last parameter in the previous command

Eg: $ls / usr/local/dic $cat! $/ a.txt

If the last path is very long, it will be very convenient.

! String

Represents the most recent command that begins with a specified string

Eg: $! ssh

Execute the most recent ssh command

!? String?

Similar to mysql's fuzzy matching, execute the most recent command that contains the specified string

Eg: $!? ssh?

Execute the most recent command that contains ssh

! n or!-n

This command is usually used with the history command

Use history to find ssh records

Eg: $! 109

Execute the history query to find out the previous command with serial number 109

$!-1

Execute the command corresponding to the current command sequence number minus one obtained sequence number

Recently, job-hopping is relatively busy, and the update is relatively slow.

Summary

The above is the whole content of this article, I hope that the content of this article has a certain reference and learning value for your study or work, if you have any questions, you can leave a message and exchange, thank you for your support.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report