uname -r
More detailed information
uname -a
lsmod
lspci -k
dmesg
.bashrc holds path variables.
ctrl-h hides and shows “dot” files in nautilus like .config
or .ssh/
sudo passwd <username>
ifconfig
ifconfig <network interface> down
ifconfig <network interface> up
ip link
ip addr
sudo apt list --installed <package-name-start*>
sudo apt --reinstall install <package>
dpkg --list | grep <package-name-fragment>
sudo libinput --list-devices
To change the file in place:
sed -i "s/regex/replace/" file
or
sed -i "s|regex|replace|" file
To copy output to a new file
sed "s/regex/replace/" filein > fileout
List all kernel images installed:
$ dpkg --list | grep linux-image
sudo reboot now
sudo shutdown now
gnome-session-quit
From https://fostips.com/lid-close-action-ubuntu-21-04-laptop/
edit /etc/systemd/logind.conf
to configure power options such as lid closing opening,
HandleLidSwitch=ignore
HandleLidSwitchExternalPower=ignore
HandleLidSwitchDocked=ignore
systemctl restart systemd-logind.service
From:
Create a new user
sudo adduser username
Find groups associated with current user:
groups $USER
Add new user to new groups
sudo usermod -aG adm username
sudo usermod -aG sudo username
#...
sudo deluser --remove-home username
passwd --expire <username_here>
from here
Expire Account
Let the account expire to disallowing a user from logging in from any source including ssh:
# disallow peter from logging in
sudo usermod --expiredate 1 peter
This is how you can reenable that account:
# set expiration date of peter to Never
sudo usermod --expiredate "" peter
users:
cut -d: -f1 /etc/passwd
getent passwd
groups:
cut -d: -f1 /etc/group
getent group
users
who
Based on this link
Might as well be fully updated first
sudo apt update
sudo apt upgrade
sudo shutdown -r now
edit which upgrade you want to do (lts or normal)
sudo nano /etc/update-manager/release-upgrades
change prompt=lts
to prompt=normal
run updater
do-release-upgrade
you may need to indicate what to do with specific config files that get updated.
Restart
sudo shutdown -r now
from here
ifconfig
host myip.opendns.com resolver1.opendns.com
dig @resolver4.opendns.com myip.opendns.com +short
https://www.lifewire.com/find-a-mac-address-using-an-ip-address-818132
arp -a <ip address>
nmcli d wifi
to run something as root
sudo <command> [command options]
to run interactively as root
sudo -i
to run something as someone else
sudo -i -u <username>
run exit
to leave that session
apt-mark showmanual
unset HISTFILE && exit
apt policy
sudo add-apt-repository --remove ppa:PPA_Name/ppa
source: https://devconnected.com/how-to-count-files-in-directory-on-linux/
ls | wc -l
For example, if “Image Viewer” is in the name of the icon:
find / -name '*.desktop' -exec grep -H 'Image Viewer' {} \; 2>/dev/null
derived from here:
Some default locations listed here:
/usr/share/applications/gnome-terminal.desktop
~/.local/share/applications/gnome-terminal.desktop
~/.config/gnome-panel/launchers/gnome-terminal.desktop
~/.gnome/apps/gnome-terminal.desktop
sudo dmidecode
sudo dmidecode -t0 # BIOS
sudo dmidecode -t1 # System
sudo dmidecode -t2 # Board
sudo dmidecode -t3 # Enclosure or Chassis
sudo dmidecode -t4 # Processor
sudo dmidecode -t1 # System
Files can be stuck in ~/.local/share/Trash/expunged when you delete from Nautilus a folder that belongs to you, but contains files which are belong to another user, and it is tricky for Nautilus to handle this situation correctly. To delete them try to use:
sudo -i
rm -rv /home/<desired_user_name>/.local/share/Trash/expunged/*
exit
stat /path/to/filename
stat -c '%A %a %n' /path/to/filename
list disks with lsblk
lsblk -f #list device details like uuid
sudo lshw -class disk
sudo fdisk -l
sudo hwinfo --disk
ls -l /dev/disk/by-path
ls -l /dev/disk/by-id
get drive information:
sudo hdparm -I /dev/sda
if you have an NVMe device…
sudo apt install nvme-cli
nvme list
#sudo nvme smart-log <node_name>
sudo nvme smart-log /dev/nvme0n1
sudo nvme id-ctrl /dev/nvme0n1
From here
##list disks
sudo fdisk -l
#if you know the disk you want info about:
sudo fdisk -l /dev/sdd
sudo mount /dev/sdd1 /media/backup
# unmount
sudo umount /media/backup
# unmount all
sudo umount -a
# force unmount
sudo umount -f /media/backup
you can get most information from lsblk if you have temporarily mounted it…
#UUID=<yourUUID> <mount_location> <filesystem> <options> <dump(use 0)> <order(use 2)>
UUID=24df9215-550f-4ca0-a9f1-8f0efd2 /media/backup ext4 defaults 0 2
once you have edited, check by running
mount -a
from here
du -sh /path/to/my/dir
list directories, one level only, from here
du -h --max-depth 1 /path/to/my/dir
df -H
from here
tree /path/to/dir
from here
#chown -R <owner> <folder_1> <folder_2> ... <folder_n>
chown -R user /home/user
printenv | grep ROS
information on nautilus-aware mount locations
from here
sudo apt install cu
cu -l /dev/ttyACM0 -s 9600
To exit enter tilde dot (~.)
sudo apt install screen
screen /dev/ttyACM0 9600