Linux Wiki
System Administration
Display Manager: emptty
https://wiki.archlinux.org/title/Display_manager
The default manjaro display (login) manager is sddm
Reload and launch sddm: sudo systemctl restart sddm
Change Session
<Ctrl>+<Alt>+<F4>
Return to default Session
<Ctrl>+<Alt>+<F3>
sudo systemctl enable --force empttynvim $XDG_CONFIG_HOME/emptty
#!/bin/sh
Environment=wayland
# source /etc/profile does not have any effect
. /etc/profile
. ~/.zshenv
. ~/.bashrc
exec ./start-dwl.sh
Window Manager: dwl
dwl Keybinds
Change no. of screens in stack with <Win-i> and <Win-d>
dwl Dependencies
pacman -S --needed foot, fnott, pactl, wmenu, slstatus, grim, slurp, bat, bat-extras, swayimg, w3m, yt-dlp, mpv, ytfzf, surfrawfzf-nova
Editing dwl
sudoedit config.hsudo make clean install
Patching dwl
cd $HOME/precompile/dwlpatchpatch -i patches/alwayscenter.patch
minimal entry to work with wmenu-run
note: I still have not figured out how to have it replace the ordinary entry
[Desktop Entry]
Type=Application
Version=1.0
Name=Chromium
Exec=env /usr/bin/chromium --password-store=basic %U
Terminal=false
Display manager fix DWL fix
Create a .desktop file
cp /usr/local/share/wayland-sessions/dwl.desktop /usr/share/wayland-sessions/
envoke start-dwl.sh
users and sudo
View default shell
cat /etc/passwd
set default login shell
/etc/default/useradd
See all users on system
sudo passwd -Sa
See users groups
groups $USERid $USER
See user’s defaults
cat /etc/passwd | grep $USER
Enable sudo without passwords (normal solution)
sudo nvim /etc/sudoersuncomment wheel nopasswd
Manjaro solution
Manjaro calls @includedir /etc/sudoers.d at the end of /etc/sudoers
echo -e "$USER ALL=(ALL:ALL) NOPASSWD: ALL\nDefaults:$USER verifypw=any\n" | sudo tee "/etc/sudoers.d/dont-prompt-$USER-for-sudo-password"
Symlinks
Call the link function to create a link names FILE2 to an existing FILE1
sudo ln -s FILE1 FILE2
Terminal sound monitor, volume and bluetooth
- pulsemixer
- wiremix
- bluetoothctl
- pulseaudio [deprecated]
- pactl [deprecated]
bluez bluez-utils
sudo systemctl status bluetooth # start/enable if needed
> bluetoothctl list
> select $CONTROLLER_MAC
> power on
bluetoothctl scan
> scan
> pair $DEVICE_MAC
> trust $DEVICE_MAC
bluetoothctl reconnect
> devices
> connect $DEVICE_MAC
Fix no bluetooth controller error
rmmod btusbrmmod intelmodprobe btusbmodprobe intel
Fix pulsewire not pointing to bluetooth pactl list sinks pactl set-defualt-sink $NUMBER_FOR_BLUETOOTH
ssh and sshd
Generate ssh key for secure login
ssh-keygen -t rsassh-copy-id user@ipaddressedit /etc/ssh/sshd_config->PermitRootLogin prohibit-password
sshd
sudo systemctl start sshdsystemctl status sshd
find ip address
if aifconfigip -o route get to 8.8.8.8 | sed -n 's/.*src \([0-9.]\+\).*/\1/p'
Increase sshd connection speed
- uncomment “UseDNS no” in sshd_config
- add “GSSAPIAuthentication no” to $HOME/.ssh/config
termux sshd
For frequented networks can set GrapheneOS wifi privacy to “use device MAC” to avoid IP address changing all the time. \
sshdifconfig
PC commands
- ssh user@IP_ADDRESS -p 8022
File send: rsync, scp
Sync your photos with PC:
rsync -av /sdcard/DCIM/ user@$IP_ADDRESS:~/Pictures/Android/
Get photos from remote Android device:
rsync -av -e 'ssh -p 8022' $IP_ADDRESS:~/storage/shared/DCIM/ /sdcard/DCIM/
Transfer to android
rsync --avrsh 'ssh -p 8022' --info=progress2 ~/Documents/maps/ $IP_ADDRESS:~/storage/shared/Documents/maps/
Sync local directories (e.g. from external sdcard to Termux home):
rsync -av /storage/0123-4567/myfiles ~/files--no-perms # fixes failed permissions issue operation not permitted (1)
scp remote folder transfer to remote
scp * scp://user@$IP_ADDRESS:8022/~/storage/shared/Documents/maps
scp remote file transfer from remote
scp scp://user@$IP_ADDRESS:8022/~/storage/shared/Documents/maps/map.pdf .
dns with /etc/resolv.conf
ls -l /etc/resolv.confsudo unlink /etc/resolv.confsudo ln -s /run/systemd/resolve/resolv.conf /etc/resolv.conf // link filesls -l /etc/resolv.confcat /etc/resolv.conf[First time start] systemctl enable systemd-resolvedreboot OR systemctl restart systemd-resolved
systemd-resolve
systemctl enable systemd-resolvededit /etc/systemd/resolved.confsystemctl restart systemd-resolvedsystemd-resolve --statusdrill google.com //verify
Mullvad VPN cli
mullvad account loginmullvad account getmullvad connectmullvad statusmullvad lan set allowmullvad disconnect
Set Default Programs: xdg-mime
https://wiki.archlinux.org/title/XDG_MIME_Applications
https://wiki.archlinux.org/title/Default_applications
https://wiki.archlinux.org/title/Xdg-utils#xdg-open
edit / view defaults here
nvim $XDG_CONFIG_HOME/mimeapps.listln -s ~/.config/mimeapps.list ~/.local/share/applications/mimeapps.list
query defaults
xdg-mime query default image/jpeg # query default for filetype
xdg-mime query filetype filename.jpeg # query filetype mime name
ls /usr/share/applications/ | bat # see all .desktop entries
xdg-mime default feh.desktop image/jpeg === xdg-settings # settings input alt
set default browser
xdg-settings --listxdg-settings get default-web-browserxdg-settings get default-url-scheme-handler mailtoxdg-settings set default-web-browser org.qutebrowser.qutebrowser.desktopxdg-settings set default-url-scheme-handler irc org.qutebrowser.desktop
set shell variables also in zshenv
export BROWSER=google-chromeexport TERM="xterm-kitty"
find filepath of default programs
whereis mpvwhich mpv
enviornment variables printenv
HDD and USB
Rescue broken usb drive (corrupted)
Format drive
lsblk -f //shows current format
sudo mkfs.vfat /dev/drive //fat32 (every OS, up to 4G)
sudo mkfs.ntfs /dev/drive //ntfs
sudo mkfs.exfat /dev/drive //exfat
sudo mkfs.ext4 /dev/drive //ext4
Burn an ISO (img) file https://wiki.manjaro.org/index.php/Burn_an_ISO_File
sudo fdisk -lsudo dd bs=4M if=/path/to/manjaro.iso of=/dev/sd[drive letter] status=progress oflag=sync
Wipe disk
sudo dd bs=4M if=/dev/zero of=/dev/sd[drive letter] status=progress oflag=sync
Delete partition
sudo fdisk /dev/sdX(replace X with your drive letter)- then type d to delete the partition
- specify the partition number
- and finally type w to write the changes
Drive health
sudo smartctl -a /dev/sdasudo badblocks -v /dev/sda -s
mount umount
https://wiki.archlinux.org/title/File_permissions_and_attributes
lsblkmount -o uid=$USER,gid=$USER /dev/sda $HOME/usb/umount -l usb/
automount drives
edit /etc/fstabLABEL=backup /backup exfat defaults 0 0
zfs
systemd configuration for zfs
enable zfs.target; zfs-import.target; zfs-import-cache.servicezpool set cachefile=/etc/zfs/zpool.cache <pool>enable zfs-mount.service
zfs setup OWC Thunderbay 4
https://wiki.archlinux.org/title/ZFS
note: zfs does not currently mount maybe because boltctl is not connected yet..? Will need to investigate further.
boltctl listboltctl authorize UUIDconnect to thunderbolt device immediatelyboltctl enroll --policy auto UUIDconnect to thunderbolt device each time it is connectedlsblkls -lh /dev/disk/by-id/mdadm --misc --zero-superblock /dev/driveerase previous raid information; if not apart of previous raid it will error: “Unrecognised md component device”lsblk -o +PHY-SECuse lsblk to list block sizeszpool create -f -m <mount> <pool> [raidz(2|3)|mirror] <ids>zpool status -vzfs listlist zfs pools and mountpointschown admin:admin contendzpool import -d /dev/disk/by-id contendto fix error if the pool was not mounted
CONTEND Raid Array (zpool create)
zpool create -f -o ashift=12 -m /home/admin/contend contend \
raidz \
ata-ST2000DL004_HD204UI_S2H7J9GC307318 \
ata-ST2000DL004_HD204UI_S2H7J9GC307335 \
ata-ST2000DL004_HD204UI_S2H7J9GC307327 \
ata-ST2000DL004_HD204UI_S2H7J9GC307324 \
Clipboard: wl-clipboard
https://github.com/bugaevc/wl-clipboard Copy a simple text message:
wl-copy Hello world!Copy the list of files in ~/Downloads:ls ~/Downloads | wl-copyCopy an image:wl-copy < ~/Pictures/photo.pngCopy the previous command:wl-copy "!!"Paste to a file:wl-paste > clipboard.txtSort clipboard contents:wl-paste | sort | wl-copyUpload clipboard contents to a pastebin on each change:wl-paste --watch nc paste.example.org 5555
keybindings: keyd
sudoedit /etc/keyd/default.conf
Virtual machines: quickemu
qemu vitalization
qemu command args
cd $HOME/VMquickemu --vm windows-10.conf --display spice- mac disc: “Disc M”
- win pwd: quickemu
- mac pwd: 1234
quickemu commands
- fullscreen toggle (spice, dwl):
Install New VM
quickget nixos unstable minimal
File Sharing
- syncthing, scp etc.
Docker compose
Edit docker
cd docker/jellyfinnvim docker-compose.yml
Docker update
sudo docker compose pull
Docker run
sudo docker compose up -d
Docker stop
sudo docker compose down
Docker status
sudo docker ps
Local server file hosting: miniserve
https://github.com/svenstaro/miniserve
limitations can only serve one directory at a time
may use links or start multiple instances
- miniserve -p 3519 DIR/
- miniserve -p 3519 FILE
Tried but did not work or like
- [deprecated] lychee -> docker (lychee requires javascript in browser)
- [deprecated] slcl (Out of date yay package)
website: jekyll
jekyll new DIRbundle exec jeckll serve --unpublished
cloudflare
- make sure I am deploying to pages not workers. URL should end in /pages.
Copy images from website
inspect mode > application > frames > images
html tips
https://www.burtonsys.com/a_little_extra_vertical_space_for_br_tag.html
https://justfuckingusehtml.com/
Version Control: git
git setup
git global settings
git config --global init.defaulBranch master
git per folder setup
cd $DIRgit init --initial-branch=main --object-format=sha1git statusgit add .git commit -m "initial commit"
Simple git workflow
cd $DIRgit statusgit add .git commit -m "message"
remote git
Clone remote directory
git clone ssh://
Update local from remote
cd $DIRgit statusgit pull $REMOTE_DIR master
Inspect remote changes before committing to origin
git fetch $REMOTE_DIR mastergit log -p HEAD..FETCH_HEAD
Push local changes
git push
Naming remotes
git remote add [remote-title] [remote-dir]git fetch [remote-title]git log -p master..[remote-title]/mastergit merge [remote-title]/master
remotes (gitlab, termux)
| phone | <-p/p-> # pull/push
| termux/srv | # --bare --share
| PC | <-p/p-> # pull/push
| gitlab | # remote
add ssh key to gitlab
wl-copy < ~/.ssh/id_rsa.pubgitlab.com > Profile > Acess > SSH keys > Add keyssh -T git@gitlab.com
Prepare bare remote repository
ssh user@$IP_ADDRESS -p 8022- ssh:
mkdir ~/srv/git/name.git - ssh:
cd ~/srv/git/name.git - ssh:
git init --bare --share
Push git repository
cd $DIRgit statusgit remote add termux ssh://user@$IP_ADDRESS:8022/~/srv/git/dotfiles.gitgit remote -vgit push termux master
git branches
git branch -v # show current branch and commit
git checkout -b master # if no branch is selected (fixes error)
git branch -d name # delete local branch
git branch -d --remote origin/master # delete remote branch
git branch -m oldname newname # rename
Managing dofiles: stow
- Move configurations to dotfiles subdirectory with path compared to home folder
cd dotfilesstow -R -v zsh
Backup Plan
- everyone needs a backup plan
Pacman
pacman -Q// querypacman -Qe// query user installed packagespacman -Qe | wc -l// count user installed packagespacman -Ss// searchpacman -S// installpacman -S–needed // only install new packagespacman -Rns// to remove package, system config files, and dependenciesexpac -S -H M '%k\t%n' $PACKAGE_NAME// To list the download size of several named packages- python packages Just use pacman or yay
Bugs
- scaling fix: Log into KDE. Dumb. I know. But it is what works to scale gtk/gdk apps. May be able to adjust kde settings.
- dark mode fix gtk settings are stored in config.ini:
nvim $XDG_CONFIG_HOME/gtk-3.0/settings.ini - Fonts
- Fixing Logos black borders
- launcher: ou dedetai
- emulate a virtual desktop
- launch an applicaion in a virtual desktop
- Switch between logos and url links
L4: logos4:Factbook;ref=bk.$24cityGate URL: https://ref.ly/logos4/Factbook?ref=bk.%24cityGate
Software
Linux utils: core utils
Posix compliance manual
regex
Core Utilities
File navigation
cd ..// Go to parent directorycd -// Go to previous working directorypwd// Print current working directory
Count files in subdirectories
find . -maxdepth 1 -mindepth 1 -type d -exec sh -c 'echo "{} : $(find "{}" -type f | wc -l)" file\(s\)' \;
Delete contents of subdirectories but not the folders
find * -type f -delete
File sizes
ls -lh
Space remaining on a drive
df -h
Shell scripting
set -eushellcheck
make executable
chmod +x script.sh
execute executable
./executable
Input and Output
- use » to append (output) to end of file
- use > to replace file (with output)
Logical Operators
A ; B -- Run A and then B, regardless of the success or failure of A
A && B -- Run B only if A succeeded
A & B -- Run B and A concurrently
A || B -- Run B only if A failed
Date formatting
man date
If statements, comparisons, conditionals
if [ $((1 + $RANDOM % 2 )) -eq 1 ]; then echo "one"; else echo "two"; figawk -k '!seen[$4]++ {print $4 " _"$5", " $6"_"}' file.csv | sort > file.txt
Calculator
qalcexpr 1 + 2echo '200 + ((9000 / 12)*0.1)' | bc
Video: mpv
mpv Play video in the terminal
mpv --profile=sw-fast --vo=kitty --vo-kitty-use-shm=yes --really-quiet video.mkvscript-opts=ytdl_hook-ytdl_path=yt-dlp
yt-dlp (Youtube player) Update using pacman
yt-dlp 'https://yt.url'ytfzfytsurf
Browser: qutebrowser
qutebrowser sessions
:w session-name # save
:session-load session name # restore
saved in dot local (see :version)
qutebrowser captcha [deprecated]
<tcH>allows cookies
images, image conversion and photo galleries
Image programs
imagemagick magick # terminal editor, transform
gwenview # view and crop
gimp # photo editing
inkscape # photo and svg editing
chafa # terminal viewer
swayimg # viewer (wayland)
libresprite # pixel art
web image size goal (width matters more)
BFN: 1200 x height px
blog: 1200 x 630 px
2-column: 600 x 400 px
3-column: 400 x 225 px
square: 400 x 400 px
favicon: 16 x 16 px
photo information
magick identify input.png
convert
magick image.png output.jpg
batch conversion of multiple PNG files
for i in *.png; do magick "$i" "${i%.*}.jpg"; done
reduce size by 50%, change to png
magick rose.jpg -resize 50% rose.png
resize height to 400 px and preserve aspect ratio
magick rose.jpg -resize x400 rose.jpg
resize width to 1200 px and preserve aspect ratio
magick rose.webp -resize 1200x rose.webpfor i in *.png; do magick "$i" -resize 1200x "${i%.*}.webp"; done
rotate:
pdfjam --landscape --angle -270 input.pdf --outfile input.pdf
crop to content
kroppdfcrop --clip input.pdf ouput.pdf
merge pdf
pdfunite input1.pdf blank.pdf input2.pdf output.pdf
reduce pdf size
ps2pdf input.pdf output.pdf
pdf to img
vips copy somefile.pdf somefile.jpg
libvips may specify dpi, specific pages, number of pages
vips copy "somefile.pdf[dpi=600,page=3,n=5]" somefile.jpg
making zines
https://equa.space/notes/pdfjam/
https://github.com/typst/typst/issues/187
booklet: | [4][1] | [2][3] |
pdfjam input1.pdf --booklet true --paper letter --lanscape --outfile output.pdf
signatures: a signature is the total number of pages
pdfjam input1.pdf --signature 16 --paper letter --lanscape --outfile output.pdf
- Tried: muttwizard (mw), neomutt, aerc
- Indexer: notmuch, alot
- Failed to install: meli, sup
email stack
w3m + gpg + pass + mbsync (isync) + notmuch -> alot
email stack config locations
mbsync: $HOME/.mbsyncrc
alot: $XDG_CONFIG_HOME/alot/config
notmuch: $HOME/.notmuch-config
w3m display emails: $HOME/.mailcap
add new email address
note: for gmail obtain https://man.sr.ht/~rjarry/aerc/providers/gmail.md
pass add mail/email@addressadd configuration in $HOME/.mbsyncrcmkdir $HOME/.local/share/mail/email@addressadd other_email=email@address in $HOME/.notmuch-configreference in $XDG_CONFIG_HOME/alot/config
sync commands
mbsync -a && notmuch newalot
contacts
- abook: I do not like abook
- contact: contact (https://github.com/neo-oli/contact)
notmuch
- config: $HOME/.notmuch-config
mbsync/isync
- config: $HOME/.mbsyncrc
- calls pass #need to figure out how it works
alot
- add $HOME/.mailcap folder: https://alot.readthedocs.io/en/latest/faq.html
- config: $XDG_CONFIG_HOME/alot/config
neomutt/muttwizard [deprecated]
- Workflow: mailsync (syncs mail), neomutt (opens viewer)
- Sync: mw -Y
aerc [deprecated]
- Workflow: aerc (client)
- Config: $XDG_CONFIG_HOME/aerc
gpg
gpg --list-secret-keys
elevating to ultimate trust
gpg --edit-key $KEY_IDtrustchange to ultimatesave
pinentry options
note: pinentry-curses does not easily work with tessen workflow
ls /usr/bin/pinentry*
to make gpg agent use tty
- add to zshrc:
export GPG_TTY=$(tty) gpg-connect-agent updatestartuptty /bye >/dev/null echo "pinentry-program /usr/bin/pinentry-qt" >> $HOME/.gnupg/gpg-agent.confgpg-connect-agent reloadagent /bye && source ~/.zshenv
change gpg password
gpg --list-secret-keys --keyid-format=longgpg --edit-key <your-key-id>passwdsave
pass
https://www.passwordstore.org/#organization
pass add mail/user@example.com # add password
pass edit mail/user@example.com # edit password
pass mail/user@example.com # print password to stdout
pass # print all folders
pass clip # fzf pass script
tessen # helper script
organization
password
user: username
otp must begin with otpauth://
pass-otp
pass otp insert otp/user@address.com < totp-secret.txt # new otp
pass otp otp/user@address.com # print otp
android password store setup
- Connect to gitlab
- add a gitlab personal access token
git clone https://oauth2:$PERSONAL_ACCESS_TOKEN@somegitlab.com/vendor/package.git
- Transfer gpg key
cat ~/.password-store/.gpg-idgpg --export-secret-keys $gpg_id > my-private-key.ascscp my-private-key.asc scp://user@$IP_ADDRESS:8022/~/shred -u my-private-key.asc
zathura
Fix clipboard echo “set selection-clipboard clipboard” » $XDG_CONFIG_HOME/zathura/zathurarc
neovim (nvim)
- Increment Selection of Numbers
- Print same number vertically i.e. 00
- Visually select columns
- Increment keybind
g<C-a>
- Wordcount
g<C-g> - Mark
m<key>, return to line<apostrophe><key>, return to character<backtick><key>
ripgrep (rg)
show filepath only
rg -l search_term
copy line to clipboard
rg -N -I search_term | xclip -selection clipboard
nvim: search through file
rg search_term specific_file.md
nvim: grep and read result into neovim
:r!rg -N -I search_term
read date into neovim
:read !date
hayagriva: search specific bibliography file
rg -N -I van ~/Documents/typst/bibliography/testa.yml
hayagriva: search cursor word
:rg -N -I <cword>:r!rg -N -I <cword> ~/Documents/typst/bibliography/testa.yml
hayagriva: search copied word
diw:r!rg -N -I <C-r>\" ~/Documents/typst/bibliography/testa.yml<CR>f:xkJx
fzf
https://github.com/junegunn/fzf?tab=readme-ov-file#usage
fzf --bind 'enter:become(vim {})'fzf "$(vim)"
The Bible in the terminal
esv package
- Uses esv API.
- https://git.sr.ht/~jeremy/esv
install
- configure not needed; just
make
usage
esv 1_corinthians 8 -l 0 | less -R --wordwrap
diatheke
https://wiki.crosswire.org/Frontends:Diatheke
e-sword modules: http://www.biblesupport.com/
https://gist.github.com/Nilpo/b887da309c05845493a5
bug fix: https://sword-devel.crosswire.narkive.com/w2zSwqWM/installmgr-does-not-install-modules-in-several-conditions
esv.shdiatheke -b system -k modulelistdiatheke -b Westminster -f plain -k /WCF/Chapter Idiatheke -b ESV2011 -f plain -k Matthew 1:5
export SWORD_PATH=~/.sword
mkdir -p $SWORD_PATH/mods.d
echo yes |installmgr -init # create a basic user config file
echo yes |installmgr -sc # sync config with list of known remote repos
echo yes |installmgr -r CrossWire\ Beta # refresh remote source
echo yes |installmgr -ri CrossWire KJV # install module from remote source
installmgr -l # list installed module
newsboat
Youtube rss
- The easiest way to get an RSS feed for a YouTube channel is visiting the channel page, for example https://www.youtube.com/@LAWRENCESYSTEMS.
- Right click on an empty part of the page and select “View Page Source” in the context menu, which will then open the page source in a new tab.
- Hit CTRL+F to pull up a search and type “channel_id=”. This URL is the RSS feed for the YouTube channel (in this case, the RSS feed URL is https://www.youtube.com/feeds/videos.xml?channel_id=UCHkYOD-3fZbuGhwsADBd9ZQ).
- Copy+Paste this link into your preferred RSS reader and rejoice.
Podcast rss
Use https://www.podbean.com/site/search/index?v= to find rss feeds
Yazi
https://kb.adamsdesk.com/application/yazi-keyboard-shortcuts/
Bulk File Editing
Yazi -> <Ctrl-a> Select All Files -> <shift-R> Edit in neovim
Android Terminal: termux
.zshrc
- fix file paths
- fix prompt
setopt CASE_GLOBfixes broken zsh syntax highlighting is broken- maybe can use seprate alias file or have defined filepaths in zshenv
zsh completion fix \
autoload -U compinit && compinit
Network and wifi
https://wiki.archlinux.org/title/NetworkManager
- nmcli
- nmcli device wifi list
- nmcli dev wifi con 26:5A:4C:2B:69:A1 password $PASSWORD name “Saint Andrew Speed”
- nmcli connection
- nmcli con delete “conname” //delete if dns problems occur
(local) Firewall
https://wiki.archlinux.org/title/Uncomplicated_Firewall
UFW
Jellyfin
force wizard
Movie naming conventions
fix broken metadata
- turn off vpn
- reboot
Rom tools
crawling the web to download
wget -m -np -c -e robots=off -R "index.html*" "[URL]"
Skraper
- Install mono and skraper
- chmod a+x SkraperUI.exe
- ./SkraperUI.exe
Skyscraper
- $HOME/.skycraper/config.ini
- $HOME/ROMS/.utilities/skyscraper/
Igir https://igir.io/
- install using npx
For importing new cartridge based system
npx igir@latest move test report --dat "No-Intro*.zip" --input input/ --output No-Intro/ --dir-dat-name