Make Apt-Get Always Run As Root

Linux only: If you have ever tried to use the apt-get command to install software but received an error because you forgot sudo, the Command-line Fu site has a quick but useful tip for you. The tip is one of those really simple, but extremely useful time-savers that might have just passed you by otherwise—instead of constantly typing "sudo" before each of the apt-get commands, simply use the alias function to add it there automatically:

alias apt-get='sudo apt-get'

To make this change persistent across sessions, you will want to add this line to your ~/.bashrc file. Experienced readers will note that you can always use the sudo !! command to run the last typed command as root whenever you forget the "sudo" the first time. Don't forget to check out our top 10 command line tools, 10 handy bash aliases, or you can learn how to use grep.


Be the first to comment on this story!

Trending Stories Right Now