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: docs/books/admin_guide/03-commands.md
+16-16Lines changed: 16 additions & 16 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -270,7 +270,7 @@ The `clear` command clears the contents of the terminal screen. In fact, to be m
270
270
271
271
In a terminal, the display will be permanently hidden, whereas in a graphical interface, a scrollbar will allow you to go back in the history of the virtual terminal.
272
272
273
-
💡 tip
273
+
💡 **Tip:**
274
274
<kbd>CTRL</kbd> + <kbd>L</kbd> will have the same effect as the `clear` command
275
275
276
276
### `echo` command
@@ -312,7 +312,7 @@ $ date -d 20210517 +%j
312
312
313
313
In this last example, the `-d` option displays a given date. The `+%j` option formats this date to show only the day of the year.
314
314
315
-
💡 Warning
315
+
💡 **Warning:**
316
316
The format of a date can change depending on the value of the language defined in the environment variable `$LANG`.
317
317
318
318
The date display can follow the following formats:
@@ -497,7 +497,7 @@ $ ls -lia /home
497
497
|`25 oct. 08:10`| Last modified date. |
498
498
|`rockstar`| The name of the file (or directory). |
499
499
500
-
💡 Note
500
+
💡 **Note:**
501
501
**Aliases** are frequently positioned in common distributions.
502
502
503
503
This is the case of the alias `ll`:
@@ -604,7 +604,7 @@ $ mkdir /home/rockstar/work
604
604
The "rockstar" directory must exist to create the "work" directory.
605
605
Otherwise, the `-p` option should be used. The `-p` option creates the parent directories if they do not exist.
606
606
607
-
💡 Danger
607
+
💡 **Danger:**
608
608
It is not recommended to use Linux command names as directory or file names.
609
609
610
610
### `touch` command
@@ -627,7 +627,7 @@ $ touch /home/rockstar/myfile
627
627
628
628
Date format: `[AAAA]MMJJhhmm[ss]`
629
629
630
-
💡 Tip
630
+
💡 **Tip:**
631
631
The `touch` command is primarily used to create an empty file, but it can be useful for incremental or differential backups for example. Indeed, the only effect of executing a `touch` on a file will be to force it to be saved during the next backup.
The `rm` command itself does not ask for confirmation when deleting files. However, with a RedHat/Rocky distribution, `rm` does ask for confirmation of deletion because the `rm` command is an `alias` of the `rm -i` command. Don't be surprised if on another distribution, like Debian for example, you don't get a confirmation request.
669
669
670
670
Deleting a folder with the `rm` command, whether the folder is empty or not, will require the `-r` option to be added.
The previous command searches forall filesin the `/tmp` directory named `*.txt` and deletes them.
1118
1118
1119
1119
1120
-
💡 Tip "Understand the `-exec` option"
1120
+
💡 **Tip:**"Understand the `-exec` option"
1121
1121
In the example above, the `find`command will construct a string representing the command to be executed.
1122
1122
1123
1123
If the `find`command finds three files named `log1.txt`, `log2.txt`, and `log3.txt`, then the `find`command will construct the string by replacing in the string `rm -f {} \;` the braces with one of the results of the search, and do this as many times as there are results.
@@ -1130,7 +1130,7 @@ The previous command searches for all files in the `/tmp` directory named `*.txt
1130
1130
1131
1131
The `;` character is a special shell character that must be protected by a `\` to prevent it from being interpreted too early by the `find`command (and not in the `-exec`).
1132
1132
1133
-
💡 Tip
1133
+
💡 **Tip:**
1134
1134
`$ find /tmp -name *.txt -delete` does the same thing.
1135
1135
1136
1136
### `whereis` command
@@ -1183,7 +1183,7 @@ The `grep` command returns the complete line containing the string you are looki
1183
1183
$ grep -w "^root" /etc/passwd
1184
1184
```
1185
1185
1186
-
💡 Note
1186
+
💡 **Note:**
1187
1187
This command is very powerful and it is highly recommended to consult its manual. It has many derivatives.
1188
1188
1189
1189
It is possible to search fora stringin a file tree with the `-R` option.
Always surround words containing meta-characters with `"` to prevent them from being replaced by the names of files that meet the criteria.
1229
1229
1230
-
💡 Warning
1230
+
💡 **Warning:**
1231
1231
Do not confuse shell meta-characters with regular expression meta-characters. The `grep`command uses regular expression meta-characters.
1232
1232
1233
1233
## Redirects and pipes
@@ -1256,7 +1256,7 @@ It is possible to redirect the input stream from another file with the character
1256
1256
$ ftp -in serverftp << ftp-commands.txt
1257
1257
```
1258
1258
1259
-
💡 Note
1259
+
💡 **Note:**
1260
1260
Only commands that require keyboard input will be able to handle input redirection.
1261
1261
1262
1262
Input redirection can also be used to simulate user interactivity. The command will read the input stream until it encounters the defined keyword after the input redirection.
@@ -1283,7 +1283,7 @@ STOP
1283
1283
1284
1284
The shell exits the `ftp`command when it receives a line containing only the keyword.
1285
1285
1286
-
💡 Warning
1286
+
💡 **Warning:**
1287
1287
The ending keyword, here `END` or `STOP`, must be the only word on the line and must be at the beginning of the line.
1288
1288
1289
1289
The standard input redirection is rarely used because most commands accept a filename as an argument.
@@ -1437,7 +1437,7 @@ For permanent use, they must be created in the :
1437
1437
*`.bashrc` file in the user's login directory;
1438
1438
* `/etc/profile.d/alias.sh` file for all users.
1439
1439
1440
-
💡 Warning
1440
+
💡 **Warning:**
1441
1441
Special care must be taken when using aliases which can be potentially dangerous! For example, an alias set up without the administrator's knowledge :
0 commit comments