Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 14 additions & 13 deletions docs/books/admin_guide/03-commands.md
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,8 @@ The `clear` command clears the contents of the terminal screen. In fact, to be m

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.

!!! Tip
!!! Tip

<kbd>CTRL</kbd> + <kbd>L</kbd> will have the same effect as the `clear` command

### `echo` command
Expand Down Expand Up @@ -612,7 +613,7 @@ The "rockstar" directory must exist to create the "work" directory.

Otherwise, the `-p` option should be used. The `-p` option creates the parent directories if they do not exist.

!!! Danger
!!! Danger

It is not recommended to use Linux command names as directory or file names.

Expand All @@ -636,7 +637,7 @@ $ touch /home/rockstar/myfile

Date format: `[AAAA]MMJJhhmm[ss]`

!!! Tip
!!! Tip

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.

Expand All @@ -654,7 +655,7 @@ $ rmdir /home/rockstar/work
| ----------------------------------------------------------------------- | ----------- |
| `-p` | Removes the parent directory or directories provided if they are empty. |

!!! Tip
!!! Tip

To delete both a non-empty directory and its contents, use the `rm` command.

Expand All @@ -666,7 +667,7 @@ The `rm` command deletes a file or directory.
rm [-f] [-r] file [file] [...]
```

!!! Danger
!!! Danger

Any deletion of a file or directory is final.

Expand All @@ -676,7 +677,7 @@ rm [-f] [-r] file [file] [...]
| `-i` | Requires confirmation of deletion. |
| `-r` | Recursively deletes subdirectories. |

!!! Note
!!! Note

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.

Expand Down Expand Up @@ -1130,7 +1131,7 @@ $ find /tmp -name *.txt -exec rm -f {} \;

The previous command searches for all files in the `/tmp` directory named `*.txt` and deletes them.

!!! Tip "Understand the `-exec` option"
!!! Tip "Understand the `-exec` option"

In the example above, the `find` command will construct a string representing the command to be executed.

Expand All @@ -1144,7 +1145,7 @@ The previous command searches for all files in the `/tmp` directory named `*.txt

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`).

!!! Tip
!!! Tip

`$ find /tmp -name *.txt -delete` does the same thing.

Expand Down Expand Up @@ -1198,7 +1199,7 @@ The `grep` command returns the complete line containing the string you are looki
$ grep -w "^root" /etc/passwd
```

!!! Note
!!! Note

This command is very powerful and it is highly recommended to consult its manual. It has many derivatives.

Expand Down Expand Up @@ -1244,11 +1245,11 @@ $ find /home -name "test[123]*"
/home/rockstar/test362
```

!!! Note
!!! Note

Always surround words containing meta-characters with `"` to prevent them from being replaced by the names of files that meet the criteria.

!!! Warning
!!! Warning

Do not confuse shell meta-characters with regular expression meta-characters. The `grep` command uses regular expression meta-characters.

Expand Down Expand Up @@ -1279,7 +1280,7 @@ It is possible to redirect the input stream from another file with the character
$ ftp -in serverftp << ftp-commands.txt
```

!!! Note
!!! Note

Only commands that require keyboard input will be able to handle input redirection.

Expand Down Expand Up @@ -1307,7 +1308,7 @@ STOP

The shell exits the `ftp` command when it receives a line containing only the keyword.

!!! Warning
!!! Warning

The ending keyword, here `END` or `STOP`, must be the only word on the line and must be at the beginning of the line.

Expand Down
12 changes: 8 additions & 4 deletions docs/books/admin_guide/04-advanced-commands.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ antoine
steven
```

!!! Note
!!! Note

`uniq` requires the input file to be sorted because it only compares consecutive lines.

Without an argument, the `uniq` command will not display identical lines that follow each other in the `firstnames.txt` file:
Expand Down Expand Up @@ -215,7 +216,8 @@ The `-I` option allows you to specify a character (in our example the `%` charac

The `yum-utils` package is a collection of utilities from different authors for `yum`, which make it easier and more powerful to use.

!!! Note
!!! Note

While `yum` has been replaced by `dnf` in Rocky Linux 8, the package name has remained `yum-utils` although it can be installed as `dnf-utils` as well. These are classic YUM utilities implemented as CLI shims on top of DNF to maintain backwards compatibility with `yum-3`.

Here are some examples of usage:
Expand Down Expand Up @@ -266,7 +268,8 @@ $ repoquery -l yum-utils

The `yumdownloader` command downloads RPM packages from the repositories.

!!! Note
!!! Note

This command is very useful to quickly build a local repository of a few rpm!

Example: `yumdownloader` will download the _repoquery_ rpm package and all its dependencies:
Expand Down Expand Up @@ -326,7 +329,8 @@ The `watch` command regularly executes a command and displays the result in the

The `-n` option allows you to specify the number of seconds between each execution of the command.

!!! Note
!!! Note

To exit the `watch` command, you must type the keys: <kbd>CTRL</kbd>+<kbd>C</kbd> to kill the process.

Examples:
Expand Down
18 changes: 12 additions & 6 deletions docs/books/admin_guide/05-vi.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,14 @@ Among these improvements, the user has syntax highlighting, which is very useful

During a session, VI uses a buffer file in which it records all the changes made by the user.

!!! Note
!!! Note

As long as the user has not saved his work, the original file is not modified.

At startup, VI is in *commands* mode.

!!! Tip
!!! Tip

A line of text is ended by pressing <kbd>ENTER</kbd> but if the screen is not wide enough, VI makes automatic line breaks, _wrap_ configuration by default. These line breaks may not be desired, this is the _nowrap_ configuration.

To exit VI, from the Commands mode, tap <kbd>:</kbd> then type:
Expand All @@ -82,7 +84,8 @@ To exit VI, from the Commands mode, tap <kbd>:</kbd> then type:

To force the exit without confirmation, you must add *!* to the previous commands.

!!! Warning
!!! Warning

There is no periodic backup, so you must remember to save your work regularly.

## Operating mode
Expand Down Expand Up @@ -197,7 +200,8 @@ In *command* mode, there are several ways to insert text.

VI switches to *insert* mode after entering one of these keys.

!!! Note
!!! Note

VI switches to *insertion* mode. So you will have to press the <kbd>ESC</kbd> key to return to *command* mode.

### In relation to a character
Expand Down Expand Up @@ -262,7 +266,8 @@ These operations are done in *command* mode.

<kbd>R</kbd><kbd>characters</kbd><kbd>ESC</kbd>

!!! Note
!!! Note

The <kbd>R</kbd> command switches to *replace* mode, which is a kind of *insert* mode.

### Words
Expand All @@ -287,7 +292,8 @@ These operations are done in *command* mode.

<kbd>c</kbd><kbd>w</kbd><kbd>_word_</kbd><kbd>ESC</kbd>

!!! Tip
!!! Tip

It is necessary to position the cursor under the first character of the word to cut (or copy) otherwise VI will cut (or copy) only the part of the word between the cursor and the end.
To delete a word is to cut it. If it is not pasted afterwards, the buffer is emptied and the word is deleted.

Expand Down
Loading