You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: supplementary_style_guide/style_guidelines/code-commands.adoc
+16-3Lines changed: 16 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,11 +7,12 @@
7
7
8
8
Some commands require root privileges to run. Users without root privileges must first do one of the following to run such a command:
9
9
10
-
* Run `su -` to switch to the root user account.
11
10
* Preface the command with `sudo` to temporarily change their current privileges.
11
+
* Run `su -` to switch to the root user account.
12
12
13
13
Use the following guidelines when you document commands that require root privileges:
14
14
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.
15
16
* 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 (`#`).
16
17
+
17
18
[NOTE]
@@ -20,8 +21,20 @@ Do not rely solely on a shell prompt in a sample command to indicate the require
20
21
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.
21
22
====
22
23
+
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
+
----
25
38
26
39
.Additional resources
27
40
* link:https://www.redhat.com/sysadmin/difference-between-sudo-su[Exploring the differences between sudo and su commands in Linux]
0 commit comments