Linux
CLI Tools
usermod
-
Add user to a group
usermod -aG group_name usernameORusermod --append --groups agroup_name usernameHere: '-aG' stands for '--append' and '--groups'.
-
Add user to multiple goups at once.
usermod -aG admins,wheel,sudo vyogamiHere: 'admins', 'wheel', 'sudo' are the name of the group and 'vyogami' is the name of the user. '-aG' stands for '--append' and '--groups'.
-
change username
usermod -l new_username old_usernameHere: '-l' stands for '--login'.
-
change user shell
usermod -s path/to/shell usernameHere: '-s' stands for '--shell'.
-
change user home directory
sudo usermod --move-home --home path/to/new_home usernameORsudo usermod -m -d path/to/new_home usernameHere: '-l' stands for '--login'.
-
change user shell
usermod -s path/to/shell usernameHere: '-s' stands for '--shell'.
-
Lock user's password
usermod -L usernameHere: '-L' stands for '--lock'.
-
Unlock user's password
usermod -U usernameHere: '-L' stands for '--unlock'.
-
Add expire date to user account
usermod -e 2024-08-21 usernameHere: '-e' stands for '--expiredate'.
lscpu
-
Display information about CPU architecture
lscpu -
Display the CPU information in human readable format.
lscpu -eHere: '-e' stands for '--extended'.
Problemo
Check battery health
upower -i /org/freedesktop/UPower/devices/battery_BAT0Changing Default Editor in shell
To set Neovim as default editor, add the following line to the shell's startup file(.bashrc, .zshrc, config.fish):
-
For zsh and bash
export EDITOR=nvim -
For fish (
~/.config/fish/config.fish):set -Ux EDITOR nvim
Special Case: visudo
sudo sanitizes environment variables, so the above method won't work for visudo. Use this command instead:
sudo EDITOR=nvim visudoAlternatively, add the following line to the top of your /etc/sudoers file:
Defaults editor=/usr/bin/nvim