Linux CheatSheet

Create a user without a home directory

useradd <username>

Create a user with a home directory

useradd -m <username>

Add a user to a group

adduser <user> <group>

Delete a user and its home directory

deluser <user> --remove-home

Change primary group for a user

usermod -G <group> <user>

List all groups

cat /etc/group

Delete a group

groupdel <group>

Get system install date

sudo dumpe2fs /dev/sda1 | grep 'Filesystem created:'

Install deb package and its dependencies

dpkg -i <filename>.deb
apt -f install
dpkg -i <filename>.deb

Add 'add-apt-repository' command

apt install software-properties-common

Upgrade all PIP packages

pip list --outdated --format=columns
pip install pipdate
pip install setuptools --upgrade
pip install wheel --upgrade

Detect DisplayManger in use

cat /etc/X11/default-display-manager

cat /etc/sysconfig/desktop

cat /etc/sysconfig/displaymanager

List all versions of a package

´apt-cache policy package´
then install using ´apt install package=version´

Exclude package from apt update/upgrade

´sudo apt-mark hold package´
use ´unhold´ to revert