Tuesday, April 18, 2017

Linux Sudo Command

Before the first time I have got to know the Linux Sudo command, I felt difficult to do some tasks that I could do very easily in Windows. Even if I wanted to edit a text file in my home built Linux:

When I was in a school, I can edit a text file very easily on Sun Microsystems Unix/Solaris:
pico index.html
Or
vi index.html
But I couldn't edit a text file using the same command using my home built Linux.

Until  someday someone told me the Linux sudo command. Sudo allows a permitted user to execute a command as the superuser or another user, as specified by the security policy.

For example, to edit a text with superuser privilege, add sudo to the front:
sudo pico index.html
Or
sudo gedit index.html
When a user type sudo command, Linux will prompt for sudo password for the first time and no need to input the password every time. That saves a lot of time and effort instead.

My practical method is in case of I cannot edit or delete a file because of insufficient privilege, I will add the sudo prefix.

No comments:

Post a Comment

How to kill an abandoned process in Linux/Unix

I remembered it, then I forgot, then I remembered it, and then I forgot again. In case of a Linux/Unit process hang, I have to figure out ...