su → is used to switch to another user su - → switches to superuser/root su -l → switches to superuser/root exit → exits from the user su -l username → switches to a specific user -c option → executes one command with the privileges of another user su -c 'ls /bin' → executes the command for root user
sudo stands for superuser do a normal user can run commands with root/admin privileges sudo ls /bin → lists the contents of bin directory sudo -l → lists what privileges are granted sudo nano /etc/sudoers → to add, remove users that can use sudo command username ALL=(ALL:ALL) ALL → use this template to add new user, replace username with the users username sudo systemctl daemon-reload → to reload sudoers file and apply changes