2020-11-21 10:07:54 +01:00
|
|
|
% misc
|
|
|
|
|
|
|
|
# Update system
|
|
|
|
sudo apt update && sudo apt upgrade
|
|
|
|
|
|
|
|
# Clean APT
|
|
|
|
sudo apt autoclean && sudo apt autoremove
|
|
|
|
|
|
|
|
# List users
|
|
|
|
cat /etc/passwd | awk -F: '{ print $1}'
|
|
|
|
|
|
|
|
# User information
|
|
|
|
sudo id <user>
|
|
|
|
|
|
|
|
# Change user password
|
|
|
|
sudo passwd <user>
|
|
|
|
|
|
|
|
# Create user with home
|
|
|
|
sudo useradd -m <username>
|
|
|
|
|
|
|
|
# Create user without home
|
|
|
|
sudo useradd <username>
|
|
|
|
|
|
|
|
# Delete an user
|
|
|
|
sudo deluser <user>
|
|
|
|
|
|
|
|
# List all groups
|
|
|
|
cat /etc/group
|
|
|
|
|
|
|
|
# Add user to group
|
|
|
|
sudo usermod -a -G <group> <user>
|
|
|
|
|
|
|
|
# Remove user from a group
|
|
|
|
sudo deluser <user> <group>
|
|
|
|
|
|
|
|
# Port binding
|
|
|
|
sudo lsof -i:<port>
|
|
|
|
|
2020-12-18 17:03:01 +01:00
|
|
|
# Get IP on interface
|
|
|
|
ip addr show dev <interface> | grep "inet " | sed "s/ *inet \([^ ]*\) .*/\1/" | awk -F: '{ print $1}'
|
|
|
|
|
|
|
|
# Get devices on interface
|
|
|
|
nmap -sP <ip>
|
|
|
|
|
2020-11-21 10:07:54 +01:00
|
|
|
$ user: cat /etc/passwd | awk -F: '{ print $1}'
|
|
|
|
$ group: cat /etc/group | awk -F: '{ print $1}'
|
2020-12-18 17:03:01 +01:00
|
|
|
$ interface: ip link | grep "^[0-9]*:" | sed "s/[0-9]*: \(.*\):.*/\1/" | awk -F: '{ print $1}'
|
|
|
|
$ ip: ip addr show dev <interface> | grep "inet " | sed "s/ *inet \([^ ]*\) .*/\1/" | awk -F: '{ print $1}'
|