Sticky Linux notes
This page keeps all Linux related quick commands and shortcuts, as well as useful other information.
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
Sourced from: stackexchange.org
View CPU information
To view information about the CPU use
cat /proc/cpuinfo
Allow users to write to specific directory
To allow any user to read/write a directory adjust permissions with:
chmod -R 0777 /path/to/dir
-R
sets the permissions recursively.
Sourced from superuser.com - Chmod to allow read and write permissions/