Commit 6ffd2425 authored by bobloblaw's avatar bobloblaw
Browse files

Updates basics_of_linux.md

Auto commit by GitBook Editor
parent 4873be20
Loading
Loading
Loading
Loading
+43 −41
Original line number Diff line number Diff line
@@ -413,88 +413,93 @@ q F10 Quit htop

Something that difference Linux from windows is how it handles installing new software. In windows you usually have to google around and then click on random scary download buttons that might fuck up your computer, or not. It's like a constant lottery where you win by no installing malware. In Linux that is usually not really an issue. That is because distros have their own software repositories from where you can download your software. This is kind of like an app-store except everything is free.

The different mayor branches of teh GNU/Linux OS have their own software repositories. Ubuntu has their own, debian has their own, and so on. 
The different major branches of teh GNU/Linux OS have their own software repositories. Ubuntu has their own, debian has their own, and so on. 

Different distros also have their own package-amangers. For example, Debian and ubuntu uses `apt`, while Redhat uses `rpm`, and Arch uses `pacman`. You should strick to your own package-manager, because even though chaning package-manager is possible it will probably just cause you more headache than benefits.

## Organizing your $path variable

I am talking about debian/ubuntu here. On other systems I don't know.
### Install package

You can define your path in `/etc/environment. If you don't have it you can create it and add the path like this:`
Example of how to install something with apt:

```
source /etc/environment && export PATH
sudo apt-get install nmap
```

If you are using zsh \(which you should\) you have to add it here
If you only have a .deb file you do this to install from the terminal:

```
sudo vim /etc/zsh/zshenv
sudo dpkg -i /path/to/deb/file
```

And add this line somewhere:

```
source /etc/environment
sudo apt-get install -f
```

### Adding a path
### Remove packages

This is a non-persistent way to add binaries to your path. Might be useful if you have entered a system that has limited binaries in the path.
This can be tricky. First find the package

```
export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
dpkg --list
```

### Install package
Then you find it in your list.

```
sudo apt-get install
sudo apt-get --purge remove nameOfProgram
```

If you only have a .deb file you do this to install from the terminal:
When you remove some package it might have requires some other dependencies. To remove those you run

```
sudo dpkg -i /path/to/deb/file
sudo apt-get autoremove
```


### Organizing your $path variable

I am talking about debian/ubuntu here. On other systems I don't know.

You can define your path in `/etc/environment`. If you don't have it you can create it and add the path like this:

```
sudo apt-get install -f
source /etc/environment && export PATH
```

### Remove packages

This can be tricky. First find the package
If you are using zsh (which you should) you have to add it here

```
dpkg --list
sudo vim /etc/zsh/zshenv
```

Then you find it in your list.
And add this line somewhere:

```
sudo apt-get --purge remove nameOfProgram
source /etc/environment
```

When you remove some package it might have requires some other dependencies. To remove those you run
### Adding a path

This is a non-persistent way to add binaries to your path. Might be useful if you have entered a system that has limited binaries in the path.

```
sudo apt-get autoremove
export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
```


### Installing custom packages

If you download a package that is not in the official repository you can put the binary in **/opt**. That is good place to put your binaries.
If you download a package that is not in the official repository you can put the binary in `/opt`. That is good place to put your binaries.

Now you need to add that path to your path-variable. Remember how we set that in **/etc/environment**. So now open up that file and add `/opt to it, so i looks like this.`
Now you need to add that path to your path-variable. Remember how we set that in `/etc/environment`. So now open up that file and add `/opt` to it, so i looks like this.

```
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/opt"
```

I always add custom binaries last. That means that if we have two binaries with the same name the machine will first select the original binary. This way you won't have to fear screwing up, by accidentally creating a new **ls** binary for example.
I always add custom binaries last. That means that if we have two binaries with the same name the machine will first select the original binary. This way you won't have to fear screwing up, by accidentally creating a new `ls` binary for example.

## 8. Cronjobs
## 7. Cronjobs

There are two ways to configure cronjobs. The first one is by putting scripts in the following folders.

@@ -607,7 +612,7 @@ umount /media/usb

Knowing how to mount and unmount might be useful if you want to get access to a remote NFS-directory. You will need to mount it to your filesystem to be able to browse it.

## Controlling services
## 10. Controlling services

### Systemctl

@@ -647,18 +652,15 @@ Init.d is just a wrapper around Systemctl. I prefer it.

This is a tool to control services more easily, what is running upon boot and so on.

## 10. Boot the system

## 11. Kernel

## 12. Init



## 13. Process utilization

## 14. Logging

## 15. network sharing

## 16. Network basics

### Netstat - Find outgoing and incoming connections