mirror of
https://github.com/tldr-pages/tldr.git
synced 2025-04-29 23:24:55 +02:00
sudo: add --login, --shell and --list examples (#5202)
add more information link
This commit is contained in:
parent
7c6dfb6d55
commit
d8be3f35a3
1 changed files with 18 additions and 5 deletions
|
@ -1,6 +1,7 @@
|
|||
# sudo
|
||||
|
||||
> Executes a single command as the superuser or another user.
|
||||
> More information: <https://www.sudo.ws/sudo.html>.
|
||||
|
||||
- Run a command as the superuser:
|
||||
|
||||
|
@ -8,16 +9,28 @@
|
|||
|
||||
- Edit a file as the superuser with your default editor:
|
||||
|
||||
`sudo -e {{/etc/fstab}}`
|
||||
`sudo --edit {{/etc/fstab}}`
|
||||
|
||||
- Run a command as another user and/or group:
|
||||
|
||||
`sudo -u {{user}} -g {{group}} {{id -a}}`
|
||||
`sudo --user={{user}} --group={{group}} {{id -a}}`
|
||||
|
||||
- Repeat the last command prefixed with "sudo" (only in bash, zsh, etc.):
|
||||
- Repeat the last command prefixed with "sudo" (only in `bash`, `zsh`, etc.):
|
||||
|
||||
`sudo !!`
|
||||
|
||||
- Launch the default shell with superuser privileges:
|
||||
- Launch the default shell with superuser privileges and run login-specific files (`.profile`, `.bash_profile`, etc.):
|
||||
|
||||
`sudo -i`
|
||||
`sudo --login`
|
||||
|
||||
- Launch the default shell with superuser privileges without changing the environment:
|
||||
|
||||
`sudo --shell`
|
||||
|
||||
- Launch the default shell as the specified user, loading the user's environment and reading login-specific files (`.profile`, `.bash_profile`, etc.):
|
||||
|
||||
`sudo --login --user={{user}}`
|
||||
|
||||
- List the allowed (and forbidden) commands for the invoking user:
|
||||
|
||||
`sudo --list`
|
||||
|
|
Loading…
Add table
Reference in a new issue