Arch Linux

Useful commands in Arch Linux

Create user with $HOME folder in a specific path [on Linux]

sudo useradd UserName -m -d /UserHomeFolder

Example: This creates the folder /@/hakesh/ as the $HOME path for the user hakesh and assigns ownership and attributes to it. It also generates the user's basic directory tree (~/.local, ~.config, etc.) and hidden files (.bashrc, .xinitrc, etc).

sudo useradd hakesh -m -d /@/hakesh

Remove all orphaned packages [on Arch Linux]

Very useful command to clean the system of unnecessary applications and vulnerabilities; especially to remove residual packages that were dependencies of already uninstalled packages.

sudo pacman -Rns $(pacman -Qtdq)

Remove a package tree with interdependence

This command is especially useful when you want to remove a package, its dependencies, and the applications that depend on the package itself. Avoid the classic error: failed to prepare transaction (could not satisfy dependencies) :: removing ... breaks dependency ... required by ... loops and save time removing packages that we don't require without leaving orphaned packages.

sudo pacman -Rcns

© Hakesh