2014-06-26 18:42:56 +05:30
|
|
|
# sudo
|
|
|
|
|
2016-01-07 18:31:27 +01:00
|
|
|
> Execute a command as another user.
|
2014-06-26 18:42:56 +05:30
|
|
|
|
2016-01-16 15:12:05 +01:00
|
|
|
- List of an unreadable directory:
|
2014-06-26 18:42:56 +05:30
|
|
|
|
2014-06-27 21:31:28 +05:30
|
|
|
`sudo {{ls}} {{/usr/local/scrt}}`
|
2014-06-26 18:42:56 +05:30
|
|
|
|
|
|
|
- To edit a file as user www:
|
|
|
|
|
2014-06-27 21:31:28 +05:30
|
|
|
`sudo -u {{www}} {{vi}} {{/var/www/index.html}}`
|
2014-06-26 18:42:56 +05:30
|
|
|
|
|
|
|
- To shutdown the machine:
|
|
|
|
|
2014-06-27 21:31:28 +05:30
|
|
|
`sudo {{shutdown}} -r +10 {{"Cya soon!"}}`
|
2014-06-26 18:42:56 +05:30
|
|
|
|
2016-01-07 18:31:27 +01:00
|
|
|
- To repeat the last command as sudo:
|
2014-06-26 18:42:56 +05:30
|
|
|
|
2014-06-27 21:31:28 +05:30
|
|
|
`sudo {{!!}}`
|