Linux sudo bang bang 到底是什么?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/15137461/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
What exactly is sudo bang bang?
提问by alestanis
采纳答案by alestanis
The bang bang (!!
) command is a shortcut to repeat the previous command you entered in your terminal. This command is very useful when you forget that you need admin rights to make a certain action, and lets you repeat it with super-user rights just by typing
bang bang( !!
) 命令是重复您在终端中输入的上一个命令的快捷方式。当您忘记执行某个操作需要管理员权限时,此命令非常有用,并且只需键入即可让您以超级用户权限重复该命令
sudo !!
instead of typing arrow-up, scrolling to the beginning of the line, adding sudo
and hitting enter (imagine scrolling through those loooongapt-get
commands). So many seconds gained! Yay!
而不是键入向上箭头,滚动到行首,添加sudo
并按回车键(想象一下滚动这些loooongapt-get
命令)。获得了这么多秒!好极了!
There are many other bang-commands such as !x
, !?x
, !!:p
and !!*
. This blog postlists them and explains what they are for.
还有许多其他爆炸的命令,例如!x
,!?x
,!!:p
和!!*
。这篇博文列出了它们并解释了它们的用途。