From c21f4de00e9610976f5b93d5e4b69079abc8b48b Mon Sep 17 00:00:00 2001 From: "hemanth.hm" Date: Thu, 26 Jun 2014 18:42:56 +0530 Subject: [PATCH 1/2] Adding docs for 'sudo' --- pages/common/sudo.md | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 pages/common/sudo.md diff --git a/pages/common/sudo.md b/pages/common/sudo.md new file mode 100644 index 0000000000..7d1138ed94 --- /dev/null +++ b/pages/common/sudo.md @@ -0,0 +1,23 @@ +# sudo + +> execute a command as another user + +- Listing of an unreadable directory: + +`sudo ls /usr/local/scrt` + +- To list the home directory of non-root user + +`sudo -u Jhon ls ~Jhon` + +- To edit a file as user www: + +`sudo -u www vi /var/www/index.html` + +- To shutdown the machine: + +`sudo shutdown -r +10 "Cya soon!"` + +- To repeat the last command as sudo + +`sudo !!` From 7e5ba0ce48efafa7d75eb3e541feb3a6469d824d Mon Sep 17 00:00:00 2001 From: "hemanth.hm" Date: Fri, 27 Jun 2014 21:31:28 +0530 Subject: [PATCH 2/2] Better formatting. --- pages/common/sudo.md | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/pages/common/sudo.md b/pages/common/sudo.md index 7d1138ed94..f2dbba1f8b 100644 --- a/pages/common/sudo.md +++ b/pages/common/sudo.md @@ -4,20 +4,17 @@ - Listing of an unreadable directory: -`sudo ls /usr/local/scrt` +`sudo {{ls}} {{/usr/local/scrt}}` -- To list the home directory of non-root user - -`sudo -u Jhon ls ~Jhon` - To edit a file as user www: -`sudo -u www vi /var/www/index.html` +`sudo -u {{www}} {{vi}} {{/var/www/index.html}}` - To shutdown the machine: -`sudo shutdown -r +10 "Cya soon!"` +`sudo {{shutdown}} -r +10 {{"Cya soon!"}}` - To repeat the last command as sudo -`sudo !!` +`sudo {{!!}}`