Sunday, December 7, 2008

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

2 comments:

Anish said...

really no idea how to do

artfwo said...

Very useful indeed, thanks for sharing!