Getting previous line in Bash after new command? -


in bash terminal, type command , realize needed sudo command. hit arrow previous command , backtrack beginning type sudo , enter.

is there way type sudo, press key pull down previous command after sudo?

thanks!

yes: can use "history expansion", , write !!:

$ foo bash: foo: command not found $ sudo !! sudo foo                             <-- prints out expanded command bash: sudo: command not found        <-- , runs 

Comments

Popular posts from this blog

delphi - How to convert bitmaps to video? -

jasper reports - Fixed header in Excel using JasperReports -

python - ('The SQL contains 0 parameter markers, but 50 parameters were supplied', 'HY000') or TypeError: 'tuple' object is not callable -