Skip to content

Commit 0c29c74

Browse files
authored
Merge pull request #427 from bburt-rh/issue-235-add-examples-to-root-cli-commands-entry
Issue #235: add some examples to root cli commands entry
2 parents dad2c77 + 9990bb4 commit 0c29c74

File tree

1 file changed

+16
-3
lines changed

1 file changed

+16
-3
lines changed

supplementary_style_guide/style_guidelines/code-commands.adoc

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,12 @@
77

88
Some commands require root privileges to run. Users without root privileges must first do one of the following to run such a command:
99

10-
* Run `su -` to switch to the root user account.
1110
* Preface the command with `sudo` to temporarily change their current privileges.
11+
* Run `su -` to switch to the root user account.
1212

1313
Use the following guidelines when you document commands that require root privileges:
1414

15+
* If a command requires a temporary switch to root privileges, use the `sudo` command at the beginning of the sample command syntax rather than the `su -` command.
1516
* If you include a shell prompt in a sample command, always show the correct prompt for a regular user (`$`) or a user with root privileges (`#`).
1617
+
1718
[NOTE]
@@ -20,8 +21,20 @@ Do not rely solely on a shell prompt in a sample command to indicate the require
2021
If you include a shell prompt to indicate that a user with root privileges must run the command, also include a statement about this requirement in the step text, the introductory text, or the prerequisites.
2122
====
2223
+
23-
* If a command requires a temporary switch to root privileges, use `sudo` at the beginning of the sample command syntax. If the sample command includes a shell prompt together with `sudo`, the prompt should remain `$` and not be changed to `#`.
24-
* If multiple commands in a procedure require root privileges, add introductory content to tell the user what to do. For example, "The commands in this procedure require root privileges to run. Either run `su -` to switch to the root user or preface the commands with `sudo`."
24+
* When a sample command includes `sudo`, use the `$` prompt, not `#`, as shown in the following example:
25+
+
26+
[source,terminal]
27+
----
28+
$ sudo systemctl start firewalld
29+
----
30+
+
31+
* If multiple commands in a procedure require root privileges, add introductory content to tell the user about the requirement.
32+
The following example shows one way that you could integrate a requirement for root access into the introduction for a procedure:
33+
+
34+
.Example AsciiDoc
35+
----
36+
Some tasks in this procedure require root privileges, which you can get temporarily by prefixing commands with `sudo`.
37+
----
2538

2639
.Additional resources
2740
* link:https://www.redhat.com/sysadmin/difference-between-sudo-su[Exploring the differences between sudo and su commands in Linux]

0 commit comments

Comments
 (0)