Skip to content

Instantly share code, notes, and snippets.

@amfischer
Last active Apr 8, 2020
Embed
What would you like to do?
Ubuntu commands cheat sheet
  • list all local users
    cut -d: -f1 /etc/passwd

  • list users and their permissions
    cat /etc/passwd

  • list groups
    cat /etc/groups

  • add new user
    sudo adduser new_username
    sudo useradd new_username

  • delete a user
    sudo userdel username
    To delete the home directory for the deleted user account:
    sudo rm -r /home/username

  • modify username
    usermod -l new_username old_username

  • change user password
    sudo passwd username

  • change user shell
    sudo chsh username

  • change user details
    sudo chfn username

  • add user to sudo group
    adduser username sudo
    usermod -aG sudo username

  • list user groups and gid
    id username

  • WireGuard start/stop cmds
    sudo wg-quick up reopen-garden sudo wg-quick down reopen-garden

  • WireGuard start on boot
    sudo systemctl enable wg-quick@reopen-garden.service

  • remove package
    sudo apt-get purge --auto-remove packagename

  • list all packages
    apt list --installed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment