===== Quicktutorials =====
==== Get OS information ====
Get OS information from ''/etc/os-release''.
Example: Debian:
PRETTY_NAME="Debian GNU/Linux 11 (bullseye)"
NAME="Debian GNU/Linux"
VERSION_ID="11"
VERSION="11 (bullseye)"
VERSION_CODENAME=bullseye
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"
Import this to a bash script via:
The var ''ID'' is then ''debian'':
if [ -f /etc/os-release ]; then
. /etc/os-release
ID=$ID
fi
Or use ''neofetch'':
neofetch
//installed via: ''apt install neofetch''//
Sourced from: [[https://unix.stackexchange.com/questions/6345/how-can-i-get-distribution-name-and-version-number-in-a-simple-shell-script|stackexchange.org]]
------
==== View CPU information ====
To view information about the CPU use
cat /proc/cpuinfo
------
==== Create .img on Linux CLI ====
It's quite simple to create an image of a disk, for example an SD card, therefore use the following command:
dd if=/path/to/device of=image.img
The ''/path/to/device'' can be found out with:
lsblk
For example it can be ''/dev/sda''.
Remind that using this method will include also empty parts. An image of a 32 GB SD card will later have a size of 32 GB although for example 16 GB are unused.
-----
==== Show WiFi password via CLI ====
Thereby that a system is required to save WiFi passwords in clear, it can also show those passwords to you.
By running the following command (NetworkManager required), the SSID, password and a QR-code of the current connected WiFi will be displayed in your CLI:
nmcli device wifi show-password