Let’s face it, You switched to Linux because you wanted freedom. But you can’t achieve freedom without using “sudo”. By default Ubuntu and many other distro’s won’t allow users to perform actions as root user or super user(su). But we can take control by using sudo and su commands. This is going to be a long post, so grab a cup of coffee and let’s get started.
Warning: Make a mess and clean-up your own mess. That’s how you can learn. If you don’t have an appetite to make a mess you shouldn’t try this.
Becoming root user :
sudo su ##to use as root user
Let us try an everyday scenario. try running “apt-get update” without sudo it’ll ask for root user permission. Some processes are limited only to root users. so to do such things we need sudo command. sudo allows a part￼ This command will remove packages with the root privileges.￼ This command will remove packages with the root privileges.
Adding a repository:
A software repository is a storage location from where software packages can be retrieved and installed.
sudo add-apt-repository ppa:ondrej/php5 sudo apt-get update
It is necessary to update run update after adding a repository.
sudo apt-get install packagename
sudo apt-get remove packagename
su command also gives similar functionality with “-c” option. But steer clear of su if you don’t know what you’re doing.
su -c apt-get install packagename
To run the process in background use,
sudo -b apt-get install packagename
Allowing other users to use sudo:
By default only the user who installed the OS have the permission to use sudo but we can add other users to this list by using the following command.
sudo adduser username sudo
sudo nano /usr/sbin/visudo
This allows you to edit visudo file. Don’t do it.
Setting pasword to root account [Highly not recommended]:
sudo passwd root
For more try
to get a detailed manual. You can perform almost every process as a root user by using sudo command.
Protip: use gksu or gksudo instead of sudo to run GUI applications as root.
Correct me if there’s any mistake. Subscribe for more new posts. Contact me for any specific tutorial.