Tip: sudo in the last command in Linux bash shell quickly.
In this post, we will look at an interesting topic how to refer the last command in bash shell.
Sudo last command quickly
### Run the command [nglinux@nglinux ~]$ tail /var/log/messages tail: cannot open `/var/log/messages' for reading: Permission denied ### Write sudo and run last command quickly ### By referring it with !! [nglinux@nglinux ~]$ sudo !! sudo tail /var/log/messages [sudo] password for nglinux: Feb 22 10:48:01 localhost rsyslogd: [origin software="rsyslogd" swVersion="5.8.10" x-pid="1478" x-info="http://www.rsyslog.com"] rsyslogd was HUPed [nglinux@nglinux ~]$
We can call the entire previous command by using this special builtin “!!”.