README.md aktualisiert

This commit is contained in:
develcookingtest 2024-10-10 20:52:05 +00:00
parent c38560a654
commit ff8926dde1
1 changed files with 37 additions and 20 deletions

View File

@ -1,3 +1,4 @@
This cheet cheet / general guide will explain what each command will do and when to use it. This cheet cheet / general guide will explain what each command will do and when to use it.
It's intended as a general guide/cheet cheet for linux beginners on the command line. It's intended as a general guide/cheet cheet for linux beginners on the command line.
@ -68,11 +69,11 @@ The Tab key is mostly forgotten today but on the command line it is essential fo
--- ---
# Common Linux Tools explained # Common Linux Tools explained
#### Sudo ### Sudo
Sudo is a program to execute a command as another user in most cases the root user. The root user is the admin of every Linux out there. So if we want to run a command with elevated privages we will use `sudo`. Common command that require given privalages are: Sudo is a program to execute a command as another user in most cases the root user. The root user is the admin of every Linux out there. So if we want to run a command with elevated privages we will use `sudo`. Common command that require given privalages are:
* `systemctl enable/disable/start/stop` * `systemctl enable/disable/start/stop`
* `apt install/remove/update/upgrade` * `apt install/remove/update/upgrade`
#### Apt ### Apt
Apt is a so called package manager. Those are used to install Software or Libarys form Package repo. Those are hosted by your Linux Distro maintainers but you can also install third party software via .deb files. Apt has many arguements the most common are `search`, `install`, `update`, `upgrade`, `remove`, `list` and `show`. Apt is a so called package manager. Those are used to install Software or Libarys form Package repo. Those are hosted by your Linux Distro maintainers but you can also install third party software via .deb files. Apt has many arguements the most common are `search`, `install`, `update`, `upgrade`, `remove`, `list` and `show`.
Here is a list which does what: Here is a list which does what:
* `search` searches throught the package index for the given string * `search` searches throught the package index for the given string
@ -96,7 +97,7 @@ Here is a list which does what:
* shows information about the package, things like dependencys upsteams Webpage, maintainer, version and so on * shows information about the package, things like dependencys upsteams Webpage, maintainer, version and so on
* `apt show firefox` * `apt show firefox`
#### Systemd/Systemctl ### Systemd/Systemctl
Systemd is that so called init system that runs daemons or sockets on a given system while systemctl is the software interface to control Systemd. Systemd is that so called init system that runs daemons or sockets on a given system while systemctl is the software interface to control Systemd.
Systemd is for the user a way to run software consitenly in the background on a given host. Common things that run like that are web, printing and virtualization. Systemd is for the user a way to run software consitenly in the background on a given host. Common things that run like that are web, printing and virtualization.
The most importend systemctl commands are `status`, `enable`, `disable`, `start`, `stop`, `restart` and `reload`. With those you can contol the systemdaemons. The most importend systemctl commands are `status`, `enable`, `disable`, `start`, `stop`, `restart` and `reload`. With those you can contol the systemdaemons.
@ -115,10 +116,10 @@ The most importend systemctl commands are `status`, `enable`, `disable`, `start`
* **reload**: Reloads the configuration of a service * **reload**: Reloads the configuration of a service
+ Example: `systemctl reload docker`. + Example: `systemctl reload docker`.
#### File navigation & management ### File navigation & management
Under Linux and other other Unix like and other Systems you will use nearly the same commands to navigate your file tree and manage them. The most well known Unix like desktopsystems are Linux, Android, MacOS and FreeBSD many command. They are mostly follow the Posix Standard. Under Linux and other other Unix like and other Systems you will use nearly the same commands to navigate your file tree and manage them. The most well known Unix like desktopsystems are Linux, Android, MacOS and FreeBSD many command. They are mostly follow the Posix Standard.
##### Core Concepts #### Core Concepts
So to understand the most common things, I will explain them now rather than later. In Linux you don't have a C: or D: drive like in Windows instead you have the `/` aka root directory. For more information about multiple drives see [mount](#mount) This directory holds all files and folders of your system. The most imported root directorys are: So to understand the most common things, I will explain them now rather than later. In Linux you don't have a C: or D: drive like in Windows instead you have the `/` aka root directory. For more information about multiple drives see [mount](#mount) This directory holds all files and folders of your system. The most imported root directorys are:
* `/etc` short for Editable Text Configuration * `/etc` short for Editable Text Configuration
* `/home` where the non root user files are located * `/home` where the non root user files are located
@ -143,21 +144,26 @@ But there are also some relative path variables that you need to remember:
* you can use the `*` as a symbol to specify that every things is meant * you can use the `*` as a symbol to specify that every things is meant
* if you want so select all files or directorys that start or end with `start` use `*start` or `start*` * if you want so select all files or directorys that start or end with `start` use `*start` or `start*`
##### Commands to Navigate your file tree #### Commands to Navigate your file tree
##### ls
* `ls` short for list is the most common command to list existing files and directorys that are inside of a given directory * `ls` short for list is the most common command to list existing files and directorys that are inside of a given directory
* `ls -a` will show you all directorys/files including hidden ones * `ls -a` will show you all directorys/files including hidden ones
* `ls -l` will show the contend in a list format * `ls -l` will show the contend in a list format
* `ls` arguments can be combined * `ls` arguments can be combined
* like `ls -la` to show all contents of a file in a list format * like `ls -la` to show all contents of a file in a list format
* in Windows you would use traditionally the `dir` command for that * in Windows you would use traditionally the `dir` command for that
##### pwd
* `pwd` will print out the current working directory * `pwd` will print out the current working directory
##### cd
* `cd` to "change the directory" * `cd` to "change the directory"
* if you run `cd` without a directory it will go to the home dir of your user like `cd ~/` * if you run `cd` without a directory it will go to the home dir of your user like `cd ~/`
* can be used with relative paths (usually way faster) * can be used with relative paths (usually way faster)
* like`cd ./.ssh` or `cd ~/.ssh` instead of ` cd /home/testuser/.ssh` * like`cd ./.ssh` or `cd ~/.ssh` instead of ` cd /home/testuser/.ssh`
* `cd !!` to go back to the previous directory * `cd !!` to go back to the previous directory
##### Modifying content #### Modifying content
##### touch ##### touch
`touch`will create a empty file `touch`will create a empty file
* `touch example.txt` * `touch example.txt`
@ -165,7 +171,7 @@ But there are also some relative path variables that you need to remember:
`mkdir` will create a empty directory `mkdir` will create a empty directory
* `mkdir ~/` * `mkdir ~/`
Edit files using an text editor of choice ex. [nano](#nano) or [vim](# Vi/Vim/Nvim) ##### Edit files using an text editor of choice ex. [nano](#nano) or [vim](# Vi/Vim/Nvim)
##### rm ##### rm
`rm` to remove files or/and directorys `rm` to remove files or/and directorys
* use `rm -r` to remove directorys * use `rm -r` to remove directorys
@ -176,7 +182,7 @@ Edit files using an text editor of choice ex. [nano](#nano) or [vim](# Vi/Vim/Nv
`cat` will print out the contend of a given file `cat` will print out the contend of a given file
* used like : `cat testfile.txt` * used like : `cat testfile.txt`
#### Piping, Redirecting and Shellscripting ### Piping, Redirecting and Shellscripting
On the most Linux systems the default shell ist "bash" on some other it is "zsh". On MacOS is "zsh" the default shell. The post imported thing is that they are Poisx complaint. On the most Linux systems the default shell ist "bash" on some other it is "zsh". On MacOS is "zsh" the default shell. The post imported thing is that they are Poisx complaint.
##### Piping ##### Piping
@ -214,11 +220,12 @@ else
fi fi
``` ```
`` ``
#### Nano ### Nano
Nano is a simple editor nice for quick edits but hides a lot of it's features behind config files. Nano is a simple editor nice for quick edits but hides a lot of it's features behind config files.
To use nano run `nano testfile.txt` if the file already exists it will load up the file. If not nano will create a new file To use nano run `nano testfile.txt` if the file already exists it will load up the file. If not nano will create a new file
If you fished your edit press `ctrl + o` to save the file and then press `ctrl + x` to exit nano If you fished your edit press `ctrl + o` to save the file and then press `ctrl + x` to exit nano
#### Vi/Vim/Nvim
### Vi/Vim/Nvim
Vi, Vim and Nvim are all text editors that build upon another. I would always recommend to use at least vim, because of it's text highlighting. The biggest upgrade to Nvim in my opinion is the build in file explorer which is really handy. They are not really easy for beginners cause the mode editor model isn't the norm nowadays and you have to remember some shortcuts. The most important is `Esc` to go back into Normal mode, then press `:` and then `q!`. This will force quit vim without saving. Vi, Vim and Nvim are all text editors that build upon another. I would always recommend to use at least vim, because of it's text highlighting. The biggest upgrade to Nvim in my opinion is the build in file explorer which is really handy. They are not really easy for beginners cause the mode editor model isn't the norm nowadays and you have to remember some shortcuts. The most important is `Esc` to go back into Normal mode, then press `:` and then `q!`. This will force quit vim without saving.
Those are all mode based editors. You have 3 distinct modes, Normal, Insert and Visual. Those are all mode based editors. You have 3 distinct modes, Normal, Insert and Visual.
@ -233,27 +240,37 @@ some useful shortcuts:
* Normal mode: press `U` to go back to the change before * Normal mode: press `U` to go back to the change before
* Normal mode: press `cont + R ` to go forward to the newest change * Normal mode: press `cont + R ` to go forward to the newest change
* Normal mode: press `/` then type in a string to search for given string thought the file * Normal mode: press `/` then type in a string to search for given string thought the file
* Nvim only Normal mode: press `:` and then `E` and `Enter` and the builtin file explorer opens it's self
#### ps/top/htop ### ps/top/htop
WIP (Work in Progress) WIP (Work in Progress)
#### dd
### dd
WIP WIP
#### Neofetch/fastfetch
### Neofetch/fastfetch
WIP WIP
#### Grep
### Grep
WIP WIP
#### ssh
### ssh
WIP WIP
#### scp
### scp
WIP WIP
#### ping
### ping
WIP WIP
#### mount
### mount
WIP WIP
#### Nice to know software
### Nice to know software
* lynx/links * lynx/links
* browsh * browsh
* wireguard * wireguard