*NIX (Linux, BSD)
Introduction
My primary OS is Linux; it was mostly Kubuntu, but elementary OS is slowly taking over my computers.
I do have other systems. In the Unix-like world, one is BSD to practice; it was PC-BSD, but now it is FreeBSD. In these pages are my various notes that I hope are helpful to folks as much as they are reminders for myself.
Oh, Mac OS is different enough in my mind that it isn't here. :-/
Compression Hints
7z a -t7z -m0=lzma -mx=9 -mfb=64 -md=32m -ms=on <destination> <source file/dir>
GZIP=-9 tar -czvf ./backup_sdcard_from_pi.img.tar.gz ./backup_sdcard_from_pi.img
uncompress: tar xvzf file.tar.gz -C /path/to/somedirectory
x = extract the files
v = verbose
z = uncompress gzip
f = argument that says file name follows
C = (optional) argument to put output in directory that follows
dd Usage
This is mostly done with Linux, but I suppose it could work in BSD, Mac OS, others?
"burn" ISO to USB: sudo dd bs=4M status=progress conv=fsync if=./some_distro.iso of=/dev/sdX
backup and compress drive to image: sudo bash -c "dd if=/dev/device-drive-or-partition | gzip > /media/disk/name-backup-file.gz"
restore compressed drive image: gunzip -c /media/disk/name-backup-file.gz | sudo dd of=/dev/device-drive-or-partition
Files & File Systems
Move contents of folder one level up:
mv ./<target_contents_subfolder>/* . && mv ./target_contents_subfolder/.* .
NOTE: the trailing dot is part of the command
NOTE: there are two commands connected via "&&"
Mount a remote file system through SSH. This "just works" on Ubuntu, you may need to install/setup sshfs and/or fuse.
sshfs my_user@remote_host:/path/to/directory <local_mount_point>
Download a shortened URL with curl:
curl -L -o filename.ext http://shortened.url
Find files that are okay in Linux, but not Windows and put the list into a text file:
find . -name "*[&<>:\\|?*]*" > ~/AndSymbols.txt
I know, technically ampersand ("&") is allowed. But FAT filesystems and older apps don't play nice.
Mount a partition in /etc/fstab via PARTUUID by using blkid command.
Set the label of an ext2/3/4 volume uses the e2label command
LXDE / LXQT
Date/Time Widget
Clock format: %I:%M %p
Tooltip format: %a %x
Full Screen Windows
This will change/enable windows to be maximized by default.
Edit ~/.config/openbox/lubuntu-rc.xml
At end of file, un-comment:
<!--
<application type="normal">
<maximized>true</maximized>
</application>
-->
Networking
Connection Drop
After converting a Mac mini (Late 2012 / Macmini6,1) to Kubuntu 24.04, it started having issues with the NIC crapping out randomly. It would drop connection after consistent traffic. Like downloading an ISO or watching a movie. After searching a bit, I found this article on reddit. In case it goes away, or anyone too lazy to follow the link, the basic information is:
edit /etc/default/grub (I use nano)
change GRUB_CMDLINE_LINUX="" to be GRUB_CMDLINE_LINUX="iommu.passthrough=1"
be sure to save (use sudo) and update-grub2
reboot
The default for Kubuntu was as above. If your distro has other options, add this at the end, separated by a space.
Broadcom Wifi
On many Apple devices from around 2010's, the Broadcom wifi that came with them is not built into many Linux distros. I have a USB wifi adapter that I use during installation and then install the Broadcom driver. The information below gets the wifi card working on different distros.
Ubuntu: sudo apt purge firmware-b43-installer && sudo apt install firmware-b43-installer
Fedora: Enable/install RPM fusion (both free & non-free). sudo dnf install akmod-wl broadcom-wl
Scanning
Scanning is something that usually doesn't enter my mind. It used to be when I couldn't get medical reports electronically. But the late 20-teens had seen most medical institutions in the US be required to have electronic records. Which are also shared; and that raises privacy issues, but I digress. Now, working from home, there are still many processes that require printing -> signing -> scanning -> emailing documents.
And since my tried and true printer as well as scanner from the early 2000's finally died....
I bought a rather inexpensive HP Envy 7855. It got many good reviews online for working with Linux. Both as a printer and scanner. It was relatively painless to setup but for those who are totally tech-clueless, you may want to rely on HP's tools and/or a USB connection. If you understand basic IP networking, you can exit the first setup screen on the built-in touch panel and enter information manually.
Now with that done, onto scanning!
In the past, I had used gscan2pdf (noobies: link is to project, use your distro's package manager to install). My old scanner was a flatbed, so no sheet feeder. The new HP Envy 7855 has one, and I'd rather use that feature. I next tried Skanlite (again, project page), but it only seemed to scan to pictures, and I need PDF. So then I tried Simple Scan (sudo apt install simple-scan); low and behold, nice shiny PDF output. :-) If you don't have fancy needs, Simple Scan is the way to go!
SDDM (Login/Display Manager)
Change DPI in SDDM (method #1):
nano -w /etc/sddm.conf
paste in below:
[X11]
EnableHiDPI=true
ServerArguments=-nolisten tcp -dpi 144
Change DPI in SDDM (method #2):
nano -w /usr/share/sddm/scripts/Xsetup
/usr/bin/xrandr --dpi 201
SLiM (Login/Display Manager)
SLiM is one of the pieces of software that manages how users log into Unix-like systems, graphically. They are referred to as both "login manager" and "display manager". I usually use the default on any system, but FreeBSD did not have one for XFCE. So I choose SLiM over XDM.
Below are some notes/hints/etc.
In FreeBSD, config file = /usr/local/etc/slim.conf
In FreeBSD, themes are in /usr/local/share/slim/themes/
I made a simple theme to understand the files.
UDEV for Android Devices
Below are UDEV rules for connecting Android devices via USB on Linux. At the end is the values for Amazon Fire 7" 5th Generation.
# udev rule to detect android devices
# Acer
SUBSYSTEM==”usb”, ATTR{idVendor}==”0502", MODE=”0666", GROUP=”plugdev”
# Archos
SUBSYSTEM==”usb”, ATTR{idVendor}==”0e79", MODE=”0666", GROUP=”plugdev”
# Asus
SUBSYSTEM==”usb”, ATTR{idVendor}==”0b05", MODE=”0666", GROUP=”plugdev”
# Azpen Onda
SUBSYSTEM==”usb”, ATTR{idVendor}==”1f3a”, MODE=”0666", GROUP=”plugdev”
# BQ
SUBSYSTEM==”usb”, ATTR{idVendor}==”2a47", MODE=”0666", GROUP=”plugdev”
# Dell
SUBSYSTEM==”usb”, ATTR{idVendor}==”413c”, MODE=”0666", GROUP=”plugdev”
# Fairphone
SUBSYSTEM==”usb”, ATTR{idVendor}==”2ae5", MODE=”0666", GROUP=”plugdev”
# Foxconn
SUBSYSTEM==”usb”, ATTR{idVendor}==”0489", MODE=”0666", GROUP=”plugdev”
# Fujitsu Toshiba
SUBSYSTEM==”usb”, ATTR{idVendor}==”04c5", MODE=”0666", GROUP=”plugdev”
# Garmin-Asus
SUBSYSTEM==”usb”, ATTR{idVendor}==”091e”, MODE=”0666", GROUP=”plugdev”
SUBSYSTEM==”usb”, ATTR{idVendor}==”18d1", MODE=”0666", GROUP=”plugdev”
# Haier
SUBSYSTEM==”usb”, ATTR{idVendor}==”201e”, MODE=”0666", GROUP=”plugdev”
# Hisense
SUBSYSTEM==”usb”, ATTR{idVendor}==”109b”, MODE=”0666", GROUP=”plugdev”
# HTC, Wiko
SUBSYSTEM==”usb”, ATTR{idVendor}==”0bb4", MODE=”0666", GROUP=”plugdev”
# Huawei
SUBSYSTEM==”usb”, ATTR{idVendor}==”12d1", MODE=”0666", GROUP=”plugdev”
# Intel
SUBSYSTEM==”usb”, ATTR{idVendor}==”8087", MODE=”0666", GROUP=”plugdev”
# K-Touch
SUBSYSTEM==”usb”, ATTR{idVendor}==”24e3", MODE=”0666", GROUP=”plugdev”
# KT Tech
SUBSYSTEM==”usb”, ATTR{idVendor}==”2116", MODE=”0666", GROUP=”plugdev”
# Kyocera
SUBSYSTEM==”usb”, ATTR{idVendor}==”0482", MODE=”0666", GROUP=”plugdev”
# Lab126
SUBSYSTEM==”usb”, ATTR{idVendor}==”1949", MODE=”0666", GROUP=”plugdev”
# Lenovo
SUBSYSTEM==”usb”, ATTR{idVendor}==”17ef”, MODE=”0666", GROUP=”plugdev”
# LG
SUBSYSTEM==”usb”, ATTR{idVendor}==”1004", MODE=”0666", GROUP=”plugdev”
# Meizu
SUBSYSTEM==”usb”, ATTR{idVendor}==”2a45", MODE=”0666", GROUP=”plugdev”
# Micromax
SUBSYSTEM==”usb”, ATTR{idVendor}==”1ebf”, MODE=”0666", GROUP=”plugdev”
# Motorola
SUBSYSTEM==”usb”, ATTR{idVendor}==”22b8", MODE=”0666", GROUP=”plugdev”
# MTK
SUBSYSTEM==”usb”, ATTR{idVendor}==”0e8d”, MODE=”0666", GROUP=”plugdev”
# NEC
SUBSYSTEM==”usb”, ATTR{idVendor}==”0409", MODE=”0666", GROUP=”plugdev”
# Nook
SUBSYSTEM==”usb”, ATTR{idVendor}==”2080", MODE=”0666", GROUP=”plugdev”
# Nvidia
SUBSYSTEM==”usb”, ATTR{idVendor}==”0955", MODE=”0666", GROUP=”plugdev”
# OnePlus Two (unknown vendor’s name)
SUBSYSTEM==”usb”, ATTR{idVendor}==”2a70", MODE=”0666", GROUP=”plugdev”
# Oppo
SUBSYSTEM==”usb”, ATTR{idVendor}==”22d9", MODE=”0666", GROUP=”plugdev”
# OTGV
SUBSYSTEM==”usb”, ATTR{idVendor}==”2257", MODE=”0666", GROUP=”plugdev”
# Pantech
SUBSYSTEM==”usb”, ATTR{idVendor}==”10a9", MODE=”0666", GROUP=”plugdev”
# Pegatron
SUBSYSTEM==”usb”, ATTR{idVendor}==”1d4d”, MODE=”0666", GROUP=”plugdev”
# Philips
SUBSYSTEM==”usb”, ATTR{idVendor}==”0471", MODE=”0666", GROUP=”plugdev”
# PMC-Sierra
SUBSYSTEM==”usb”, ATTR{idVendor}==”04da”, MODE=”0666", GROUP=”plugdev”
# Qualcomm
SUBSYSTEM==”usb”, ATTR{idVendor}==”05c6", MODE=”0666", GROUP=”plugdev”
# Rockcwell Electronics
SUBSYSTEM==”usb”, ATTR{idVendor}==”2207", MODE=”0666", GROUP=”plugdev”
# SK Telesys
SUBSYSTEM==”usb”, ATTR{idVendor}==”1f53", MODE=”0666", GROUP=”plugdev”
# Samsung
SUBSYSTEM==”usb”, ATTR{idVendor}==”04e8", MODE=”0666", GROUP=”plugdev”
# Sharp
SUBSYSTEM==”usb”, ATTR{idVendor}==”04dd”, MODE=”0666", GROUP=”plugdev”
# Sony
SUBSYSTEM==”usb”, ATTR{idVendor}==”054c”, MODE=”0666", GROUP=”plugdev”
# Sony Ericsson
SUBSYSTEM==”usb”, ATTR{idVendor}==”0fce”, MODE=”0666", GROUP=”plugdev”
# Spreadtrum
SUBSYSTEM==”usb”, ATTR{idVendor}==”1782", MODE=”0666", GROUP=”plugdev”
# T & A Mobile Phones
SUBSYSTEM==”usb”, ATTR{idVendor}==”1bbb”, MODE=”0666", GROUP=”plugdev”
# Teleepoch
SUBSYSTEM==”usb”, ATTR{idVendor}==”2340", MODE=”0666", GROUP=”plugdev”
# Texas Instruments UsbBoot
SUBSYSTEM==”usb”, ATTR{idVendor}==”0451", MODE=”0666", GROUP=”plugdev”
# Toshiba
SUBSYSTEM==”usb”, ATTR{idVendor}==”0930", MODE=”0666", GROUP=”plugdev”
# Wearners
SUBSYSTEM==”usb”, ATTR{idVendor}==”05c6", MODE=”0666", GROUP=”plugdev”
# Wileyfox
SUBSYSTEM==”usb”, ATTR{idVendor}==”2970", MODE=”0666", GROUP=”plugdev”
# XiaoMi
SUBSYSTEM==”usb”, ATTR{idVendor}==”2717", MODE=”0666", GROUP=”plugdev”
# YU
SUBSYSTEM==”usb”, ATTR{idVendor}==”1ebf”, MODE=”0666", GROUP=”plugdev”
# Zebra
SUBSYSTEM==”usb”, ATTR{idVendor}==”05e0", MODE=”0666", GROUP=”plugdev”
# ZTE
SUBSYSTEM==”usb”, ATTR{idVendor}==”19d2", MODE=”0666", GROUP=”plugdev”
# ZUK
SUBSYSTEM==”usb”, ATTR{idVendor}==”2b4c”, MODE=”0666", GROUP=”plugdev”
# Amazon Fire 5th
SUBSYSTEM==”usb”, ATTR{idVendor}==”1949", MODE=”0660", GROUP=”plugdev”