Add a new user
$ useradd <USERNAME> -u <USER_ID> -s /bin/bash
$ useradd ktrushin -u 1000 -g 1000 --create-home --user-groupAdd an existing user to an existing group
$ sudo usermod -aG <group_name> <user_name>Change user uid and gid
$ usermod -u <NEWUID> <LOGIN>
$ groupmod -g <NEWGID> <GROUP>Merge two directories:
$ rsync -a source_dir/* dest_dir/Memory a process consumes (in KB)
$ ps --no-header -C <process_command> -o rss | awk '{rss += $1};END{print rss}'
$ smem -P <process_command> -c pss -H | \
python3 -c "from fileinput import input; print(sum(map(int, input())))"List hardware on a PC
$ lshw
$ lspci
$ lsusb
$ inxiGet date as unixtime
$ date +%sConvert a date to unixtime
$ date -d "2015-09-04 13:35:00" +%sConvert unixtime to a date
$ date -d @1451573940Fix Ctrl-Shift-e in terminator
$ ibus-setupThen remove the keybinding for Emoji
Restart GUI:
- change to another virtual console using <ctrl+alt+f2>
- login
- run
sudo systemctl restart systemd-logindorsudo systemctl restart gdm - change back to the virtual console where GUI is bind to using <ctrl+alt+f7>
Install system monitor GNOME extensions on Ubuntu 20.04:
- install required packages
$ sudo apt-get install gir1.2-gtop-2.0 gir1.2-nm-1.0 gir1.2-clutter-1.0 \ gnome-system-monitor gnome-shell-extension-system-monitor - restart the machine
Install system monitor GNOME extensions on Ubuntu 22.04:
- remove
chrome-gnome-shell$ sudo apt-get purge chrome-gnome-shell
- install
gnome-browser-connectorof version 42.0 or higher$ sudo apt-get update && sudo apt-get install gnome-browser-connector - alternatively, compile
gnome-browser-connectorfrom source and install manually$ sudo apt-get install git meson $ git clone https://gitlab.gnome.org/nE0sIghT/gnome-browser-connector.git $ cd gnome-browser-connector $ meson --prefix=/usr builddir $ sudo install -C builddir - install required packages
$ sudo apt-get install gir1.2-gtop-2.0 gir1.2-nm-1.0 gir1.2-clutter-1.0 \ gnome-system-monitor
- restart the machine
- install the
system-monitor-nextGNOME extension
Lock screen when lid is closed:
- In Gnome Tweaks, enable
General -> Suspend when laptop lid is closed - In
/etc/systemd/logind.conf, uncomment theHandleLidSwitchandHandleLidSwitchExternalPowerand change their values as follows:
HandleLidSwitch=lock
HandleLidSwitchExternalPower=lock
Install Windows 11 into VirtualBox: before installing, disable Settings -> System -> Enable EFI (special OSes only)
Install HP MFP m137fnw:
- Connect the printer to the Wi-Fi network via HP Smart app
- Discover the printer via Settings->Printers menu
- Install airscan:
$ sudo apt-get install sane-airscan- Go to here, choose Linux -> Ubuntu and download the driver.
- Untar the driver and execute
install.shwith sudo - In the
Settings->Printersmenu select the printer settings, hit thePrinter Detailsbutton, update the printer name to the desired one and hit theInstall PPD filebutton, choose the/usr/share/ppd/uld-hp/HP_Laser_MFP_13x_Series.ppdfile.
A data scrubbing command to prevent a bit rot on an external flash-memory-based drive (SSD, USB flash drive):
$ sudo dd if=/dev/disk/by-label/<drive_name> of=/dev/null iflag=nocache status=progress
X selection: copy primary to clipboard
- install
xsel$ sudo apt-get install xsel - add a keyboard shortcut
Ctrl + Insertwith the commandsh -c 'xsel --output --primary | xsel --input --clipboard'and the namex_selections_copy_primary_to_clipboard
Logitech Spotlight
Connect the device via bluetooth, not via a dongle. To enable the pairing mode
on the device, hold the top and the bottom buttons simultaneously for 3 sec.
To connect an already paired device, press the big > button three times.
Start projecteur using the command:
$ QT_QPA_PLATFORM=xcb projecteurCheck Enable multi-screen overlay. Change other settings if required, then
close the window. Projecteur remains active (see the icon on the top panel) and
doesn't intervene into your presentation.