2014-06-26 18:42:56 +05:30
|
|
|
# sudo
|
|
|
|
|
2018-10-22 11:20:30 -06:00
|
|
|
> Executes a single command as the superuser or another user.
|
2021-01-30 22:04:40 +01:00
|
|
|
> More information: <https://www.sudo.ws/sudo.html>.
|
2014-06-26 18:42:56 +05:30
|
|
|
|
2018-10-22 11:20:30 -06:00
|
|
|
- Run a command as the superuser:
|
2014-06-26 18:42:56 +05:30
|
|
|
|
2018-10-23 12:18:36 -06:00
|
|
|
`sudo {{less /var/log/syslog}}`
|
2014-06-26 18:42:56 +05:30
|
|
|
|
2018-10-22 11:20:30 -06:00
|
|
|
- Edit a file as the superuser with your default editor:
|
2014-06-26 18:42:56 +05:30
|
|
|
|
man, sudo, mount, file, curl, ps, seq, gdb, cat, upower, cal: add option placeholders (#15915)
2025-03-11 08:07:57 +02:00
|
|
|
`sudo {{[-e|--edit]}} {{/etc/fstab}}`
|
2014-06-26 18:42:56 +05:30
|
|
|
|
2018-10-22 11:20:30 -06:00
|
|
|
- Run a command as another user and/or group:
|
2014-06-26 18:42:56 +05:30
|
|
|
|
man, sudo, mount, file, curl, ps, seq, gdb, cat, upower, cal: add option placeholders (#15915)
2025-03-11 08:07:57 +02:00
|
|
|
`sudo {{[-u|--user]}} {{user}} {{[-g|--group]}} {{group}} {{id -a}}`
|
2014-06-26 18:42:56 +05:30
|
|
|
|
2024-03-10 03:53:17 -03:00
|
|
|
- Repeat the last command prefixed with `sudo` (only in Bash, Zsh, etc.):
|
2014-06-26 18:42:56 +05:30
|
|
|
|
2017-09-20 22:45:15 +01:00
|
|
|
`sudo !!`
|
2017-11-27 17:48:29 +11:00
|
|
|
|
2021-01-30 22:04:40 +01:00
|
|
|
- Launch the default shell with superuser privileges and run login-specific files (`.profile`, `.bash_profile`, etc.):
|
2017-11-27 17:48:29 +11:00
|
|
|
|
man, sudo, mount, file, curl, ps, seq, gdb, cat, upower, cal: add option placeholders (#15915)
2025-03-11 08:07:57 +02:00
|
|
|
`sudo {{[-i|--login]}}`
|
2021-01-30 22:04:40 +01:00
|
|
|
|
|
|
|
- Launch the default shell with superuser privileges without changing the environment:
|
|
|
|
|
man, sudo, mount, file, curl, ps, seq, gdb, cat, upower, cal: add option placeholders (#15915)
2025-03-11 08:07:57 +02:00
|
|
|
`sudo {{[-s|--shell]}}`
|
2021-01-30 22:04:40 +01:00
|
|
|
|
|
|
|
- Launch the default shell as the specified user, loading the user's environment and reading login-specific files (`.profile`, `.bash_profile`, etc.):
|
|
|
|
|
man, sudo, mount, file, curl, ps, seq, gdb, cat, upower, cal: add option placeholders (#15915)
2025-03-11 08:07:57 +02:00
|
|
|
`sudo {{[-i|--login]}} {{[-u|--user]}} {{user}}`
|
2021-01-30 22:04:40 +01:00
|
|
|
|
|
|
|
- List the allowed (and forbidden) commands for the invoking user:
|
|
|
|
|
man, sudo, mount, file, curl, ps, seq, gdb, cat, upower, cal: add option placeholders (#15915)
2025-03-11 08:07:57 +02:00
|
|
|
`sudo {{[-l|--list]}}`
|