su starts a shell as another user. It is commonly used to switch to the root account or to test commands under a different account.
Switch to another user
su - username
The hyphen starts a login shell, so the target user’s environment is loaded.
Switch to root
su -
This normally asks for the root password. On distributions where the root account is locked, use sudo instead.
Run one command
su - username -c 'command'
For administrative work, sudo is often preferred because it provides finer-grained privilege control and better auditability than sharing the root password.