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
2 changes: 1 addition & 1 deletion docs/books/admin_guide/01-presentation.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ In this chapter you will learn about GNU/Linux distributions.

Linux, UNIX, BSD, Windows, and MacOS are all **operating systems**.

!!! abstract
!!! abstract
An operating system is a **set of programs that manages the available resources of a computer**.

Among this management of resources, the operating system has to:
Expand Down
32 changes: 16 additions & 16 deletions docs/books/admin_guide/03-commands.md
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ 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 @@ -317,7 +317,7 @@ $ date -d 20210517 +%j

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.

!!! Warning
!!! Warning
The format of a date can change depending on the value of the language defined in the environment variable `$LANG`.

The date display can follow the following formats:
Expand Down Expand Up @@ -502,7 +502,7 @@ $ ls -lia /home
| `25 oct. 08:10` | Last modified date. |
| `rockstar` | The name of the file (or directory). |

!!! Note
!!! Note
**Aliases** are frequently positioned in common distributions.

This is the case of the alias `ll`:
Expand Down Expand Up @@ -610,7 +610,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.

### `touch` command
Expand All @@ -633,7 +633,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.

### `rmdir` command
Expand All @@ -650,7 +650,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.

### `rm` command
Expand All @@ -661,7 +661,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.

| Options | Information |
Expand All @@ -670,7 +670,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.

Deleting a folder with the `rm` command, whether the folder is empty or not, will require the `-r` option to be added.
Expand Down Expand Up @@ -1123,7 +1123,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.

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.
Expand All @@ -1136,7 +1136,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.

### `whereis` command
Expand Down Expand Up @@ -1189,7 +1189,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.

It is possible to search for a string in a file tree with the `-R` option.
Expand Down Expand Up @@ -1234,10 +1234,10 @@ $ 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.

## Redirects and pipes
Expand Down Expand Up @@ -1267,7 +1267,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.

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.
Expand All @@ -1294,7 +1294,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.

The standard input redirection is rarely used because most commands accept a filename as an argument.
Expand Down Expand Up @@ -1448,7 +1448,7 @@ For permanent use, they must be created in the:
* `.bashrc` file in the user's login directory;
* `/etc/profile.d/alias.sh` file for all users.

!!! Warning
!!! Warning
Special care must be taken when using aliases which can be potentially dangerous! For example, an alias set up without the administrator's knowledge:

```bash
Expand Down