2
0
mirror of https://github.com/chubin/cheat.sheets synced 2024-11-15 06:12:59 +00:00
cheat.sheets/sheets/sudo
2017-05-31 09:48:36 +02:00

34 lines
635 B
Plaintext

# sudo
# Execute a command as another user.
# List of an unreadable directory:
sudo ls /usr/local/scrt
# To edit a file as user www:
sudo -u www vi /var/www/index.html
# To shutdown the machine:
sudo shutdown -h +10 "Cya soon!"
# To repeat the last command as sudo:
sudo !!
# Save a file you edited in vim
:w !sudo tee > /dev/null %
# Make sudo forget password instantly
sudo -K
# List your sudo rights
sudo -l
# Add a line to a file using sudo
echo "foo bar" | sudo tee -a /path/to/some/file
# run root shell
sudo -i
# to disable password for sudo for user superuser add
# superuser ALL=(ALL) NOPASSWD:ALL
# in /etc/sudoers