Tuesday, January 13, 2009

Simple but useful Linux Trick

How often have you typed in a command and then realized that you forgot to type sudo. This will help you, don/t need to type the long long command.

type the following !! will replace your last command

$ sudo !!

Example
$ vi /etc/apt/sources.list
this will open file as read only you need sudo to edit the file

$ sudo !!

this will expand your command automatically to

$ sudo vi /etc/apt/sources.list