mirror of
https://codeberg.org/Mo8it/How_To_Linux.git
synced 2024-12-04 19:10:32 +00:00
Compare commits
3 commits
483a138fb6
...
2b92b1ee40
Author | SHA1 | Date | |
---|---|---|---|
2b92b1ee40 | |||
c25903807c | |||
04df4eb0bb |
3 changed files with 25 additions and 21 deletions
|
@ -8,15 +8,17 @@ Therefore, we need to learn how to install so called packages to get access to a
|
|||
|
||||
### Package managers
|
||||
|
||||
In Linux, you don't install programs by using a search engine to find a website, then visit the website and download an installer then run the installer and click "Next" 100 times without even reading what you are agreeing to.
|
||||
In Linux, you don't install programs by using a search engine to find a website, then visit the website and download an installer, then run the installer and click "Next" and "Agree" 100 times without even reading what you are agreeing to.
|
||||
|
||||
This method is too insecure. You have to trust the website that you did visit. You have to hope that no malware is delivered while you are downloading the installer from the website. You can get the malware either from the website itself or through a man in the middle attack. Then the installer might do whatever it wants. You just click "Next" and suddenly your system shows you ads or your browser search machine is overwritten. Surprise! 🎉
|
||||
This method is too insecure. You have to trust the website that you did visit. You have to hope that no malware is delivered while you are downloading the installer from the website. You can get the malware either from the website itself or through a man-in-the-middle attack. Then the installer might do whatever it wants. You just click "Next" and suddenly your system shows you (extra) ads or your browser search preferences are overwritten with Yahoo. Surprise! 🎉
|
||||
|
||||
In Linux, you (mainly) install software through the package manager that ships with your distribution. The software is then downloaded from a repository which is a collection of packages that is managed by the distribution. The distribution managers make sure that no malware is added to the repository. The package manager does also take care of verifying the downloaded package before installation. This is done using some cryptographic methods and prevents man in the middle attacks or installation of packages that were corrupted during the download process.
|
||||
In Linux, you (mainly) install software through the package manager that ships with your distribution. The software is then downloaded from a repository which is a collection of packages that is managed by the distribution. The distribution managers make sure that no malware is added to their repositories.
|
||||
|
||||
The package manager does take care of verifying the downloaded packages before installation. This is done using some cryptographic methods and prevents man-in-the-middle attacks or installation of packages that were corrupted during the download process.
|
||||
|
||||
The package manager does also take care of installing any other packages that you did not specify but are required by the package that you want to install. These packages are called dependencies.
|
||||
|
||||
Since the book uses a Fedora system for demonstrations, the package manager that the book will use Fedora's package manager `dnf`.
|
||||
Since this book uses a Fedora system for demonstrations, the book will use Fedora's package manager `dnf`.
|
||||
|
||||
If you are using another Linux distribution, you might need to replace the commands of `dnf` with `apt` for Debian based distributions for example.
|
||||
|
||||
|
@ -26,17 +28,19 @@ To install a package, you need administrative privileges. Therefore, we need som
|
|||
|
||||
Lets install our first package! To do so, enter `sudo dnf install cmatrix`. You will be asked for the password of your user. Type the password and then press `Enter`. For security reasons, you will not be able to see you password while entering it. So don't wonder why nothing happens while typing the password. Just type it and then press `Enter`.
|
||||
|
||||
The package manager might then need some time to sync some data, but then it will show you a summary of what it will do and ask you for confirmation. Type `y` for _yes_ and then press `Enter` for the installation to start.
|
||||
The package manager might need some time to sync some data, then it will show you a summary of what it will do and ask you for confirmation. Type `y` for _yes_ and then press `Enter` for the installation to start.
|
||||
|
||||
After the installation is done, you can enter `cmatrix` now. Congratulations, you are now a hacker! 💻🤓
|
||||
After the installation is done, you can enter `cmatrix`. Congratulations, you are a hacker now! 💻🤓
|
||||
|
||||
To exit the matrix, press `q`.
|
||||
|
||||
If you don't like the matrix and you want to remove it? You can uninstall packages using `sudo dnf uninstall PACKAGENAME`. In this case: `sudo dnf uninstall cmatrix`. You have to confirm again with `y`.
|
||||
What if you don't like the matrix and want to remove it? You can uninstall packages using `sudo dnf uninstall PACKAGENAME`. In this case: `sudo dnf uninstall cmatrix`. You have to confirm again with `y`.
|
||||
|
||||
While installing or uninstalling packages, it is important to take a look at the summary before confirming the action with `y`. There is a reason why a confirmation is required. Sometimes, some packages depend on packages with older versions than the versions that exist on your machine. If you want to install those packages anyway, other packages that depend on the newer versions can break!
|
||||
Why do we speak about _packages_ instead of programs when installing software on Linux? Because packages can contain more than one binary (the actual programs) and extra files. Take a look at [the files that are installed with `cmatrix` on Fedora](https://packages.fedoraproject.org/pkgs/cmatrix/cmatrix/fedora-rawhide.html#files) for example.
|
||||
|
||||
Just don't blindly press `y`. If the package manager gives you a warning before doing something, enter this warning in a search engine and read about what it means before continuing.
|
||||
> Warning ⚠️ : While installing or uninstalling packages, it is important to take a look at the summary before confirming the action with `y`. There is a reason why a confirmation is required. Sometimes, some packages depend on packages with older versions than the versions that exist on your machine. If you want to install those packages anyway, other packages that depend on the newer versions can break!
|
||||
>
|
||||
> Just don't blindly press `y`. If the package manager gives you a warning before doing something, enter this warning in a search engine and read about what it means before continuing.
|
||||
|
||||
### Sudo
|
||||
|
||||
|
@ -63,7 +67,7 @@ If you don't have access to `sudo` and try to use it, then you get an output lik
|
|||
|
||||
[![](https://imgs.xkcd.com/comics/incident.png)](https://xkcd.com/838/)
|
||||
|
||||
> Warning ⚠ : Use `sudo` with great caution! Do not run a command from the internet that you don't understand! Especially if it needs to be run with `sudo`! RED FLAG! 🔴
|
||||
> Warning ⚠️ : Use `sudo` with great caution! Do not run a command from the internet that you don't understand! Especially if it needs to be run with `sudo`! RED FLAG! 🔴
|
||||
>
|
||||
> Look up a command before you run it.
|
||||
>
|
||||
|
|
|
@ -16,7 +16,7 @@ Visualise your house structure and content using `tree` and make a screenshot.
|
|||
|
||||
Now, clone your whole house and then rename the persons in the new house. Make another screenshot of `tree` afterwards.
|
||||
|
||||
In the new house, choose a non empty room and move everything with this room into another room. Why? Because zombies are back! They did get in through the window...
|
||||
In the new house, choose a non empty room and move everything within this room into another room. Why? Because zombies are back! They did get in through _windows_...
|
||||
|
||||
Make a screenshot of `tree`.
|
||||
|
||||
|
@ -26,8 +26,8 @@ Make a final `tree` screenshot of the rest of the house.
|
|||
|
||||
Take a screenshot of the content of some files. Tipp: 😺
|
||||
|
||||
- If you somehow get lost, use `pwd`.
|
||||
- If you need are looking for an option but you can not remember it, use `--help`.
|
||||
- If you get lost, use `pwd`.
|
||||
- If you are looking for an option but you can not remember it, use `--help`.
|
||||
|
||||
## Task 2: Reset your password
|
||||
|
||||
|
@ -55,6 +55,6 @@ Now install the package `lolcat`.
|
|||
|
||||
Lets call the wisdom command you did take the last screenshot of `COMMAND`.
|
||||
|
||||
Now run `COMMAND | lolcat`. Describe what did change. Can you guess how this does internally work?
|
||||
Now run `COMMAND | lolcat`. Describe what changed. Can you guess how this internally works?
|
||||
|
||||
Now read the help of `lolcat` and find out how you add some randomness. Run the command above again with the option you found and take a screenshot after you are satisfied with the randomness you get.
|
||||
Now read the help of `lolcat` and find out how to add some randomness. Run the command above again with the option you found and take a screenshot after you are satisfied with the randomness you get.
|
||||
|
|
|
@ -399,15 +399,15 @@ You might think that you don't need autocompletion at all. But you should use it
|
|||
|
||||
When you type `cat hapy_house/ru` and then press `Tab`, you don't get any autocompletion although you would expect it. But did you notice the missing `p` in `happy`?
|
||||
|
||||
This is what is meant by verification. If you don't get an autocompletion although you think that you should, then check what you have typed so far. It is much easier to correct things this way that having to correct them after trying to run the command.
|
||||
This is meant by verification. If you don't get an autocompletion although you think that you should, then check what you have typed so far. It is much easier to correct things this way than having to correct them after trying to run the command.
|
||||
|
||||
But what if you did run a command with a mistake and you have to correct it? Or what if you want to run the same command with small modifications? Do you have type the whole command again?
|
||||
But what if you did run a command with a mistake and you have to correct it? Or what if you want to run the same command with small modifications? Do you have to type the whole command again?
|
||||
|
||||
Fortunately, no! You can use the up and down arrows to navigate through your commands history. Try it out!
|
||||
|
||||
If you started typing a command and you did notice that you did miss something in the middle of the command, you might try to use the mouse and click. No clicks will help you! Instead, use the left and right arrow keys.
|
||||
|
||||
If you want to go to the beginning of the command, press `Ctrl + a`. You can go then back to the end with `Ctrl + e`.
|
||||
If you want to go to the beginning of the command, press `Ctrl + a`. Then you can go back to the end with `Ctrl + e`.
|
||||
|
||||
If you want to close a session quickly, press `Ctrl + d`. For now, this will close your terminal. Later, when we use SSH to access other Linux machines, `Ctrl + d` will close the connection and bring you back to the prompt of your machine.
|
||||
|
||||
|
@ -417,11 +417,11 @@ Lets write a very small program in Python. Enter `nano nonstop.py` and type in t
|
|||
from time import sleep
|
||||
|
||||
while True:
|
||||
print("You can not stop me, can you?")
|
||||
print("You can't stop me, can you?")
|
||||
sleep(1)
|
||||
```
|
||||
|
||||
Now exit the file while saving the buffer. If you don't know about Python, don't worry. You don't need any programming skills for now. All that you have to know is that this program runs forever and prints "You can not stop me, can you?" every second.
|
||||
Now exit the file while saving the buffer. If you don't know about Python, don't worry. You don't need any programming skills for now. All that you have to know is that this program runs forever and prints "You can't stop me, can you?" every second.
|
||||
|
||||
You should not write endless loops. This is only a demonstration for a program that is running and you would like to stop.
|
||||
|
||||
|
@ -437,7 +437,7 @@ No, not in the terminal. If you want to copy text in the terminal, then select i
|
|||
|
||||
To paste text into the terminal, press `Ctrl + Shift + v`.
|
||||
|
||||
Why is it so inconvenient? It has historical reasons. You have to take it as it is 🙁
|
||||
Why is copying and pasting so inconvenient? It has historical reasons. You have to take it as it is 🙁
|
||||
|
||||
---
|
||||
|
||||
|
|
Loading…
Reference in a new issue