# nifty ## ant (garmin) * `antfs-cli --pair` - pair watch to pc * `antfs-cli --upload` - upload data to pc * files are transferred to `~/.config/antfs-cli/[device_id]/activities` **src:** * [https://gitlab.com/klevstul/privateIssues/issues/400#note\_255420822](https://gitlab.com/klevstul/privateIssues/issues/400#note_255420822) --- ## batch resize and compress images `mkdir converted;for photos in *.jpg;do convert -verbose "$photos" -quality 90% -resize 1920x1080 ./converted/"reduced_$photos"; done` **src:** * [https://linuxsuperuser.com/batch-resize-compress-photos-linux/](https://linuxsuperuser.com/batch-resize-compress-photos-linux/) --- ## bluetooth ``` $ sudo systemctl start bluetooth $ bluetoothctl [bluetooth]# power on [bluetooth]# scan on [bluetooth]# pair 40:C1:F6:7A:37:E6 [bluetooth]# connect 40:C1:F6:7A:37:E6 [JBL Go 3]# ... [bluetooth]# devices Device B8:D5:0B:D0:06:B0 HK Onyx Studio 3 [bluetooth]# connect B8:D5:0B:D0:06:B0 ``` --- ## change cursor pointer theme `$ appearance-menu` --- ## chmod The Octal digits used for assigning permissions are as follows: | Octal Digit | Permissions | | --- | --- | | 7 | rwx | | 6 | rw- | | 5 | r-x | | 4 | r-- | | 3 | \-wx | | 2 | \-w- | | 1 | \--x | | 0 | (none) | --- ## dmenu - run mode & cache update if app runs in background or using terminal `ls ~/.config/dmenu-recent/ [background* | terminal*]` in these files the commands are defined or stored, and you can edit them. edit / delete cahced entries, located in: `~/.cache/dmenu-recent/` --- ## drive and file management * **automount:** * [automount harddrive on startup](docs/automount.md) * **partitioning:** * using gparted, create new partition table of type `gpt`, then create a new `ext4` partition. * **access rights** * `$ sudo chown 1000:100 /run/media/klevstul/cacheDrive/` * `$ sudo chmod 755 /run/media/klevstul/cacheDrive/` * **iso checking** * download both the `.iso` and the related `.md5` file * `md5sum -c filename.iso.md5` * **iso burning:** (to usb thumb drives) * `lsblk` (locate drive letter) * `sudo dd bs=4M if=/path/to/manjaro.iso of=/dev/sd[driveLetter] status=progress oflag=sync` * **secure delete:** * `srm -i -v file.txt` * **size of directories:** * `du -sh /home/klevstul/* | sort -hr` * `du -sh .[!.]* * | sort -hr` (calculating current dir, standing in ~/home dir - includes hidden system folders) * `du -h --max-depth=1` * `du -h --max-depth=1 /media/drive2/cloud-drive/Dropbox/` * ref: [https://linuxconfig.org/list-all-directories-and-sort-by-size](https://linuxconfig.org/list-all-directories-and-sort-by-size) --- ## debugging run `sudo dmesg -w` - then, plug in the usb and check the output messages run `lsusb` to see if the usb is listed run `lsblk` to see if the usb is listed --- ## diff `diff --brief --recursive /media/nas/cb/cbdb /media/drive2/nass/cb/cbdb` src: [https://www.baeldung.com/linux/compare-two-directories](https://www.baeldung.com/linux/compare-two-directories) --- ## encryption/decryption ## symmetric ``` # zip and encrypt $ 7za a archive.7z directory/ $ gpg -c archive.7z # `-c` is the same as `--symmetric` # decrypt and unzip $ gpg -d archive.7z.pgp > archive.7z $ 7za x archive.7z ``` ## key ### first time setup ``` gpg --gen-key Real name: Frode Klevstul` Email address: frode@klevstul.com` gpg: revocation certificate stored as '/home/poq/.gnupg/openpgp-revocs.d/2C6781ED21DF77ADA325BB8F7B048108A509A75D.rev' public and secret key created and signed. pub ed25519 2025-11-10 [SC] [expires: 2028-11-09] 2C6781ED21DF77ADA325BB8F7B048108A509A75D uid Frode Klevstul sub cv25519 2025-11-10 [E] [expires: 2028-11-09] ``` ### use existing key #### encrypt/decrypt * encrypt: `$ gpg --encrypt --sign --recipient frode@klevstul.com test.txt` * (pre nov 25: `$ gpg --encrypt --sign --recipient frode@thisworld.is test.txt`) * decrypt: `$ gpg --output out.txt --decrypt test.txt.gpg` ### backup * simple: * make a backup of the folder `~/.gnupg` or, alternatively: having opened the cryptLocal cryptomator vault, do the following to back up the key: * `cp -r /home/poq/.gnupg/openpgp-revocs.d/2C6781ED21DF77ADA325BB8F7B048108A509A75D.rev /home/poq/.local/share/Cryptomator/mnt/cryptLocal/content/keys/openPgp/.gnupg` * `gpg --armor --export frode@klevstul.com > /home/poq/.local/share/Cryptomator/mnt/cryptLocal/content/keys/openPgp/.gnupg/251110_frodeKlevstul_publicKey.asc` * `gpg --armor --export-secret-keys frode@klevstul.com > /home/poq/.local/share/Cryptomator/mnt/cryptLocal/content/keys/openPgp/.gnupg/251110_frodeKlevstul_privateKey.asc` --- ## git ### initialise new repository ``` git init . git add -A git commit -am "Initial commit" git push ``` ref: [https://stackoverflow.com/questions/65033357/git-init-new-from-existing-repository](https://stackoverflow.com/questions/65033357/git-init-new-from-existing-repository) --- ## hard drive * use `gnome-disk-utility` **src:** * [https://forum.manjaro.org/t/solved-how-to-encrypt-an-external-hard-drive-in-manjaro/120058](https://forum.manjaro.org/t/solved-how-to-encrypt-an-external-hard-drive-in-manjaro/120058) --- ## feh (image viewer) `feh -d --draw-exif --draw-tinted --recursive` * [https://feh.finalrewind.org/](https://feh.finalrewind.org/) * [man feh](https://man.finalrewind.org/1/feh/) --- ## find/grep/search ### find example how to search in files, locating files of type `.desktop` containing `gitkraken`: `[klevstul@x270mjr ~]$ find / -name '*.desktop' -exec grep -H 'gitkraken' {} \; 2>/dev/null` another search, this time for a string in files: `root@humhub:~# find /var/www/humhub/ -type f -exec grep -l "initial_password" {} \;` ### grep -rniw search for file containing `pagan`: `[klevstul@silentGamerMjr ~]$ grep -rniw '/run/media/klevstul/raid/Dropbox/gitlab/myPlaylists/' -e 'pagan'` src: [https://unix.stackexchange.com/questions/524828/what-does-grep-w-do](https://unix.stackexchange.com/questions/524828/what-does-grep-w-do) ### grep -rni `grep -rni "text string" /path/to/directory` src: [https://www.linuxjournal.com/content/how-search-and-find-files-text-strings-linux](https://www.linuxjournal.com/content/how-search-and-find-files-text-strings-linux) --- ## ffmpeg commands * [webm to mp4 conversion using ffmpeg](https://stackoverflow.com/questions/18123376/webm-to-mp4-conversion-using-ffmpeg) * `ffmpeg -fflags +genpts -i 1.webm -r 24 1.mp4` | * [Converting mkv to h264 FFmpeg](https://stackoverflow.com/questions/30898671/converting-mkv-to-h264-ffmpeg) * `ffmpeg -i input.mkv -c copy output.mp4` (fast - no conversion) * `ffmpeg -i input.mkv -c:v libx264 -c:a aac output.mp4` (recompiling) * [How can I reduce a video's size with ffmpeg?](https://unix.stackexchange.com/questions/28803/how-can-i-reduce-a-videos-size-with-ffmpeg) * `ffmpeg -i input.mp4 -vcodec libx265 -crf 28 output.mp4` * [Scaling](https://trac.ffmpeg.org/wiki/Scaling) * `ffmpeg -i input.mp4 -vf scale=320:240,setsar=1:1 output.mp4` --- ## fonts * alt 1: install from aur (often starts with `otf-` (preferred) or `ttf-`) * alt 2: add fonts to `~/.local/share/fonts` or `/usr/share/fonts` * maybe: restart application or run `fc-cache` --- ## git * `git commit -a -m "upd"` * `git push origin master` ``` touch README.md git init git checkout -b main git add README.md git commit -m "genesis" git remote add origin ssh://git@gt.op.fo:2002/fro/hyprarco.git git push -u origin main ``` src: [https://www.atlassian.com/git/tutorials/saving-changes/git-commit](https://www.atlassian.com/git/tutorials/saving-changes/git-commit) [https://www.atlassian.com/git/tutorials/syncing/git-push](https://www.atlassian.com/git/tutorials/syncing/git-push) --- --- ## networking (inc wifi) * `ifconfig -a` (alternative to windows' `ipconfig -all`) * `route -n` (get info about gateway) * `nmtui` - to open an interactive ui for connecting to wifi * `nm-connection-editor` - network manager gui applet * `nm-applet` - toolbar applet * `sudo systemctl restart NetworkManager` - restart network --- ## openssh generate keypair: `$ ssh-keygen -t rsa -b 2048` view the public key: `$ less /home/klevstul/.ssh/id_rsa.pub` copy this public key to `.ssh/authorized_keys` on the remote server. ## pacman, aur & yay ### misc commands * `sudo pacman -Syyu` - sync and upd * `sudo pacman -Syuu` - sync, update and allow downgrades * `sudo pacman -Rns ` - uninstall * `sudo pacman -Rs $(pacman -Qqdt)` - remove unused packages (WARNING: can remove too much!) ``` -S: Sync packages -y: refresh package database -uu: sys upgrade all packages, repeated 'u' flag enables downgrades ``` ### updating mirrors * `ct s mirrors` * this command triggers `rate-mirrors` and updating of `mirrorlist` * use web * [https://archlinux.org/mirrorlist/](https://archlinux.org/mirrorlist/) ### cache clearing * pacman * `sudo trash-put /var/cache/pacman/pkg/*` * yay * `trash-put .cache/yay/*` avoids errors like: ``` ==> Validating source files with sha256sums... tuxedo-drivers-dkms-4.13.1.tar.gz ... FAILED ==> ERROR: One or more files did not pass the validity check! ``` ### aur: manual installation of packages * if `.tar.gz` * `cd /media/cacheDrive/buildDir/` * `wget [link_to_aur_snapshot_tar_gz]` * `tar -xvzf [package.tar.gz]` * `cd [package/]` * `makepkg -si PKGBUILD (-s syncdependencies, -i install)` * if `.git` * `cd /tmp` * `git clone https://aur.archlinux.org/yay.git` * `cd yay` * `makepkg -si` Troubleshooting: Error: `FAILED (unknown public key 615D449FE6E6A235)` Fix: `gpg --recv-keys 615D449FE6E6A235` ### yay Search for packages with: ``` yay search_term ``` Install the packages with: ``` yay -S package_name ``` Remove packages with: ``` yay -R package_name ``` To delete a package with its dependencies: ``` yay -Rns package_name ``` Upgrading (only) the AUR packages: ``` yay -Sua ``` ### ERROR: One or more files did not pass the validity check! ``` cd /tmp/ git clone https://aur.archlinux.org/microsoft-azure-vpn-client-bin.git cd microsoft-azure-vpn-client-bin/ updpkgsums makepkg -si ``` --- ## printers (cups) * [http://localhost:631/admin](http://localhost:631/admin) (admin) - login: poq/poq.L1 * [http://localhost:631/printers/Brother\_HL-L2310D\_series](http://localhost:631/printers/Brother_HL-L2310D_series) (manage brother) --- ## processes * `ps aux` * `ps aux | grep 'pulse'` * `top` * `htop` * `pstree` * **kill:** * `pstree -p` * `kill [PID]` or `kill -9 [PID]` --- ## qt library * error: `Cannot mix incompatible Qt library (5.15.5) with this library (5.15.6)` * fix: `pamac build qt5-styleplugins` --- ``` $ rename -help Usage: rename [options] ... Rename files. Options: -v, --verbose explain what is being done -s, --symlink act on the target of symlinks -n, --no-act do not make any changes -a, --all replace all occurrences -l, --last replace only the last occurrence -o, --no-overwrite don't overwrite existing files -i, --interactive prompt before overwrite -h, --help display this help -V, --version display version ``` example, rename .265 to .265.mp4 for all files in a directory: `rename -n -v '.265' '.265.mp4' *` --- ## services * list: `systemctl list-units --type service --all` * enable: `sudo systemctl enable nohang-desktop` * start: `sudo systemctl start nohang-desktop` --- ## shortcuts * [atom](https://github.com/nwinkler/atom-keyboard-shortcuts) * [shotcut](https://www.shotcut.org/howtos/keyboard-shortcuts/) --- ## verify files using signature * `signify -Cqp factory.pub -x crosshatch-factory-2020.05.05.02.zip.sig && echo verified` * requires [signify](https://github.com/aperezdc/signify) (comminity tool) * ref: [https://grapheneos.org/install](https://grapheneos.org/install) --- ## sound ## list sound cards * `cat /proc/asound/cards` * `aplay -L` or `arecord -L` (list cards and devices) ## set default sound card * `asoundconf set-default-card [card_name]` * example: `asoundconf set-default-card R14PM` * `speaker-test -c 2` (test default card) ## speaker test * `speaker-test -Dfront:R14PM -c 2` (test two channel front speakers on card R14PM) * example: `front:CARD=R14PM,DEV=0, R-14PM, USB Audio, Front speakers` * `pavucontrol` - pulse audio volume control --- ## ssh * `$ ssh -l [username] -p [port] [ip]` * on host machine: `$ export TERM=xterm` --- ## symbolic links * `$ ln -s /path/to/original_source /path/to/link_target` * eg: `$ ln -s /home/klevstul/.config/STAMP .` (create a link to `STAMP` in current folder) --- ## swap * status: `swapon` * disable: `sudo swapoff /dev/dm-1` * enable: `sudo swapon /dev/dm-1` * turn off: comment out in `sudo nano /etc/fstab` * change size: use GParted src: [archlinux.org](https://wiki.archlinux.org/index.php/Swap) --- ## terminal ## issue on remote machine problem: `Error opening terminal: xterm-kitty.` solution: `# export TERM=xterm` --- ## theme change * either find a theme in aur/arc, or download a theme, like: * [https://www.gnome-look.org/p/1253385](https://www.gnome-look.org/p/1253385) * extract theme to `/home/poq/.themes` * same thing for icons: * [https://www.opendesktop.org/p/1305251](https://www.opendesktop.org/p/1305251) * extract to `/home/poq/.icons` * run `lxappearance` and update widget and icon theme * `$ export GTK_THEME=Sweet-Dark-v40:dark` * (or, this might be sufficient: `$ export GTK_THEME=Sweet-Dark-v40`) * `$ sudo nano /etc/environment` * set: `GTK_THEME=Sweet-Dark-v40:dark` src: [https://gitlab.com/pqq/pIssues.2/-/issues/113](https://gitlab.com/pqq/pIssues.2/-/issues/113) --- ## tor with firefox * `$ systemctl start tor` * foxyproxy: `socks5 w/ dns 127.0.0.1:9050` * test: `curl --socks5-hostname localhost:9050 https://check.torproject.org` src: [devdungeon.com](https://www.devdungeon.com/content/setting-tor-proxy-and-hidden-services-linux) --- ## vpn ## protonvpn * download config file from [https://account.protonvpn.com/downloads](https://account.protonvpn.com/downloads) (gnu/linux, udp) * locate username and password at [https://account.protonvpn.com/account#passwords](https://account.protonvpn.com/account#passwords) * left click connection icon in status bar, choose: * vpn connection > add a vpn connection > import a saved vpn configuration * navigate to the downloaded config > select it > enter your protonvpn username (OpenVPN / IKEv2 username) and password (OpenVPN / IKEv2 password) **src:** * [https://protonvpn.com/support/linux-vpn-setup/](https://protonvpn.com/support/linux-vpn-setup/) ### stuck / blocked connection * (uninstall protonvpn client) * `nmcli connection show --active` * Remove any reference to protonvpn * `nmcli connection delete [name-of-connection]` * example: `nmcli connection delete pvpn-ipv6leak-protection` ``` [poq@t470p ~]$ nmcli con NAME UUID TYPE DEVICE .TigoWiFi-370758465/0 aa456038-fcb0-4d1c-ad6d-18d7ad3dbadd wifi wlp3s0 lo 6105f6f5-49b6-4f52-9b9d-cee491d5ccdd loopback lo -_- d7e4b5f1-7e74-4299-833c-7b7a37ea2ab2 wifi -- Proton VPN CO#20 509b5321-be73-4969-afec-e0a7c4de86d9 vpn -- Wired connection 1 4395f2d8-010b-3809-9a5b-b786b5447faa ethernet -- [poq@t470p ~]$ nmcli connection delete 509b5321-be73-4969-afec-e0a7c4de86d9 Connection 'Proton VPN CO#20' (509b5321-be73-4969-afec-e0a7c4de86d9) successfully deleted. ``` --- ## wacom configuration use command `xsetwacom list devices` to find the id for type 'stylus' and map that to main monitor 'HEAD-0'. example: ``` $ xsetwacom list devices Wacom Intuos3 6x11 Pen stylus id: 9 type: STYLUS Wacom Intuos3 6x11 Pad pad id: 10 type: PAD Wacom Intuos3 6x11 Pen eraser id: 15 type: ERASER Wacom Intuos3 6x11 Pen cursor id: 16 type: CURSOR $ xsetwacom set "9" MapToOutput HEAD-0 ``` requires: * `xf86-input-wacom` src: * [https://wiki.archlinux.org/index.php/Wacom\_tablet](https://wiki.archlinux.org/index.php/Wacom_tablet) * [https://hitsim.com/hub/linux-xfce-configure-wacom-tablet-dual-monitor-setup/](https://hitsim.com/hub/linux-xfce-configure-wacom-tablet-dual-monitor-setup/) --- ## x11 keyboard key names > `xev` lets you find the keycode / keysym of a key. src: * [http://xahlee.info/linux/linux\_show\_keycode\_keysym.html](http://xahlee.info/linux/linux_show_keycode_keysym.html) example of mediakeys (when pressing `fn`): ``` XF86AudioRaiseVolume XF86AudioLowerVolume XF86AudioPlay XF86AudioPrev XF86AudioNext XF86AudioStop ```