Knowing which sudo or su command to execute is important. Jack Wallen demystifies these two Linux administration tools.
“data-credit =” Image: iStock / Spectral-Design “> Image: iStock / Spectral-Design
If you are a new Linux administrator, you probably know at least sudo. Sudo stands for “super user do” and allows standard users to perform administrator-level actions, such as installing software. Although almost all Linux distributions use sudo, some of them (like Fedora and openSUSE) allow you to su (switch users) to the superuser account – also known as root.
There are different ways to use sudo and su. Let’s unravel the mystery.
If you issue the command su, you change your user to root, which then executes only the .bashrc file that belongs to root. Run the command su – is that you invoke a login shell after switching the user, which resets most of the environment variables, providing a clean base.
WATCH: Linux file and directory management commands (TechRepublic Premium)
If you only use sudo, you run a command with administrator privileges. If you run the command sudo su – you will switch to the root user who will run all / etc / profile, .profile and .bashrc files by root, but only if the user running the command is defined in the / etc / sudoers file, effectively becoming the root user , even if the root user is disabled, as in Ubuntu.
Finally, if you issue the command sudo su, you switch to the root user, without resetting the environment variables, so you have root user privileges, but not the environment. Most of the time, you just need to perform the basics sudo or su commands. However, if there is a command that you must execute and it will fail with a minimum sudo command, anyone sudo – or sudo su – will always work.
Just use these commands carefully, so you don’t end up wreaking havoc on your Linux desktop or server.
Subscribe to TechRepublic’s How To Make Tech Work on YouTube for all the latest technology advice for business professionals from Jack Wallen.