What is the purpose of sudo bang bang (sudo !!
) and when might one need to use it?
相关问题
- Is shmid returned by shmget() unique across proces
- how to get running process information in java?
- JQ: Select when attribute value exists in a bash a
- Error building gcc 4.8.3 from source: libstdc++.so
- Why should we check WIFEXITED after wait in order
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 typinginstead 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!There are many other bang-commands such as
!x
,!?x
,!!:p
and!!*
. This blog post lists them and explains what they are for.