Arch Linux is an independently developed,
x86-64 general-purpose Linux distribution that strives to provide the latest stable versions of most software by following a rolling-release model.
The default installation is a minimal base system, configured by the user to only add what is purposely required.
Pacman, a package manager written specifically for Arch Linux, is used to install, remove and update software packages.
Arch Linux uses a rolling release model, meaning there are no “major releases” of completely new versions of the system; a regular system update is all that is needed to obtain the latest Arch software;
the installation images released every month by the Arch team are simply up-to-date snapshots of the main system components.
Arch Linux has comprehensive documentation, consisting of a community-run wiki known as the ArchWiki. read more…
If you experience glitches on booting the installation medium with a nVidia graphics card and do not see the command line
edit USBDEVICE/loader/entries/01-archiso-x86_64-linux.conf
on your installation medium device
and add nomodeset as boot parameter
Tip
Press E during systemd-boot selection and pass nomodeset
Boot the installation medium and ensure that you’re using EFI
ls /sys/firmware/efi
Ensure you have internet connectivity
Plug in a ethernet cable or if you use Wi-Fi
wifi-menu
Login to your Network and note your IPADRESS
ip a s
Check the Network Connection
ping-c31.1.1.1
Set USB installation media password for the root user
passwd
Enable SSH on the installation medium
systemctl start sshd
systemctlstatus sshd
Tip
You may continue the installation through SSH from another Computer
ssh root@IPADRESS
Check the avaible devices
lsblk-f
Choose the device you want to install Arch Linux
Partition disk
cfdisk /dev/nvme1n1
Select GPT label type, then select Free Space then hit on New from bottom menu.
Type the partition size in GiB (1G) and press enter key, select Type from bottom menu and choose EFI System partition type.
For /(root) partition use the following configuration: New -> Size: 100G-> Type Linux root.
For /home partition use the following configuration: New -> Size: rest of free space -> Type Linux home.
Option
Size
Type
/boot
1G
EFI System partition
/(root)
100G
Linux root
/home
Rest
Linux home
Warning
All previous files on the device will be erased
After you review the partition table select Write,
answer with yes in order to apply disk changes and then, type quit to exit cfdisk utility.
Tip
You can also review the partition table summary by running fdisk command.
default arch.conf
timeout0console-mode max
editor no
auto-entries0auto-firmware1
Add an entry for Arch Linux
/boot/loader/entries/arch.conf
title Arch Linux
linux /vmlinuz-linux
initrd /amd-ucode.img
initrd /initramfs-linux.img
optionsroot=UUID=1314508c-df47-4972-822c-7e60c9cd12eb rw quiet
Info
If you are dual booting Windows you can add an manual entry for it
/boot/loader/entries/windows.conf
title Microsoft Windows
efi /EFI/Microsoft/Boot/bootmgfw.efi
Set root password
passwd
Change root shell
usermod-s /usr/bin/zsh root
Create non-privileged user and add him to the wheel group
Warning
Create a normal user for daily use. Do not use the root user for daily use.
useradd-m-G wheel -s /usr/bin/zsh USER
Set user password
passwd USER
Edit sudoers
/etc/sudoers
# Enable insults
Defaults insults
# Ask for the root password instead of the user password
Defaults targetpw
# Infinite password timeout
Defaultspasswd_timeout=0# # Password timeout
# Defaults passwd_timeout=1800
uncomment root ALL=(ALL) ALL
uncomment %wheel ALL=(ALL:ALL) ALL
Warning
Set Sudoers default file permissions
The owner and group for the sudoers file must both be 0.
The file permissions must be set to 0440.
These permissions are set by default, but if you accidentally change them,
they should be changed back immediately or sudo will fail.
chown-c root:root /etc/sudoers
chmod-c0440 /etc/sudoers
Networking
Disable systemd-networkd and istall Network Manager
NetworkManager prefers known wireless networks and has the ability to switch to the most reliable network.
Warning
You must ensure that only one service that wants to configure the network is running.
Multiple networking services will conflict.
You can find a list of the currently running services with systemctl --type=service and then stop them.
Exit chroot, unmount and reboot
exit
umount-R /mnt
reboot now
Autoupdate mirrorlist
Install reflector
pacman-Syu reflector
Edit reflector configuration
/etc/xdg/reflector/reflector.conf
# Recommended Options
# Set the output path where the mirrorlist will be saved (--save).
--save /etc/pacman.d/mirrorlist
# Select the transfer protocol (--protocol).
--protocol https
# Select the country (--country).
# Consult the list of available countries with "reflector --list-countries" and
# select the countries nearest to you or the ones that you trust. For example:
--country Switzerland,Germany
# Use only the most recently synchronized mirrors (--latest).
--latest10# Sort the mirrors by synchronization time (--sort).
--sort rate
Enable reflector timer and start reflector service
systemctl start reflector.service
systemctl enable reflector.timer
Discard unused packages weekly to prevent the directory to grow indefinitely in size
Install optional firmware for the default linux kernel to get rid of the annoying
‘WARNING: Possibly missing firmware for module:’ message
yay-Syu mkinitcpio-firmware
Note
Despite XFS supporting async discard since kernel 4.7, xfs still recommends “that you use the fstrim application to discard unused blocks
rather than the discard mount option because the performance impact of this option is quite severe.”
Enable weekly TRIM service for SSD devices
systemctl enable fstrim.timer
Enable Logrotate
systemctl enable logrotate.timer
/etc/logrotate.conf
# uncomment this if you want your log files compressed
compresscompresscmd /usr/bin/zstd
compressext .zst
compressoptions-T0--longuncompresscmd /usr/bin/unzstd
Remove memory limit
mkdir-pv /etc/security/limits.d
/etc/security/limits.d/10-gcr.conf
* hard memlock unlimited
* soft memlock unlimited
* hard nofile 1048576
# This config file enables a /dev/zram0 device with the default settings:
# — size — same as available RAM or 8GB, whichever is less
# — compression — most likely lzo-rle
#
# To disable, uninstall zram-generator-defaults or create empty
# /etc/systemd/zram-generator.conf file.
[zram0]zram-size= min(ram, 8192)
A desktop environment (DE) is made of a bundle of programs, which share a common graphical user interface (GUI).
A desktop environment bundles together a variety of components to provide common graphical user interface elements such as icons, toolbars, wallpapers, and desktop widgets. Additionally, most desktop environments include a set of integrated applications and utilities. Most importantly, desktop environments provide their own window manager, which can however usually be replaced with another compatible one.
System Settings > Input Devices > Keyboard > Advanced > Caps Lock key behavior > Caps Lock is disabled
Tip
KDE Plasma tiling
Activate it in System Settings > Workspace Behavior > Desktop Effects
andthen you can tile a window dragging it while holding down the Shift key.
To create custom tile layouts, hold down the Meta key, and then press T.
Tip
KDE fix Firefox fonts
fc-match sans fc-match serif fc-cache --really-force
List of applications
Visual Studio Code
yay-Syu visual-studio-code-bin
Tip
Fix VS Code remote connection uses 100% CPU of remote machine
Set settingsSync.keybindingsPerPlatform to false
Set search.followSymlinks to false
Confusingly, it is shown as Disabled
But this means that any customization on that is disabled
In the dropdown choose Caps Lock is disabled option and you are done
Unlock the keyring for a display manager
/etc/pam.d/login
#%PAM-1.0
auth required pam_securetty.so
auth requisite pam_nologin.so
auth include system-local-login
auth optional pam_gnome_keyring.so
account include system-local-login
session include system-local-login
session optional pam_gnome_keyring.so auto_start
Set login keyring as default
~/.local/share/keyrings/default
login
Automatically change default keyring password with user password
Update your archlinux-keyring before upgrading your system
pacman-Sy archlinux-keyring &&pacman-Su
Skip a specific package when upgrading the system
pacman-Syu--ignore=PACKAGE
Error: failed to commit transaction (conflicting files)
pacman-Syu PACKAGE --overwrite FILEPATH
Error: unable to lock database
rm /var/lib/pacman/db.lck
Create list of installed packages
pacman-Qqen> pkglist
pacman--overwrite-S$(< pkglist
pacman-Qqdn> pkglist_deps
pacman--overwrite--asdeps-S$(< pkglist_deps
Script to update the system
~/bin/update
#!/bin/bash
sudo /root/bin/update
chmod700 ~/bin/update
/root/bin/update
#!/bin/bash
GREEN='\033[0;32m'echo-e"${GREEN}Updating keyring"&&pacman-Sy archlinux-keyring --noconfirm&&echo-e"${GREEN}Running pacman updates"&&pacman-Syu--noconfirm&&echo-e"${GREEN}Running AUR updates"&&sudo-u wildw1ng yay -Syu--devel--needed--removemake--noconfirm--answerclean All --answerdiff None &&echo-e"${GREEN}Checking for orphans and dropped packages"&&pacman-Qdtpacman-Qtdq|pacman-Rscn-
echo-e"${GREEN}System is up to date"PS3="Please select an option: "options=(rebootshutdown continue)select menu in "${options[@]}";doecho-e"\nyou picked $menu ($REPLY)"if[[$menu=="reboot"]];thenreboot;break;elif[[$menu=="shutdown"]];thenshutdown now The system is going down for required maintenance. Please save any important work you are doing now!;break;elsebreak;fidone
chmod700 /root/bin/update
Hardware video acceleration
How to enable hardware video acceleration
Enable encoding with NVENC
NVENC requires the nvidia_uvm module and the creation of related device nodes under /dev.
Manually loading the nvidia_uvm module will not create the device nodes, but invoking the nvidia-modprobe utility will.
Verify WebRender is enabled under Compositing and ensure you are not running Software WebRender.
It should be enabled by default in GNOME and other desktop environments.
about:config
Set flags gfx.webrender.all to true to force enable Hardware WebRender. media.ffmpeg.vaapi.enabled to true in order to enable the use of VA-API with FFmpeg. media.ffvpx.enabled to false to disable the internal decoders for VP8/VP9. This is necessary despite this bug being fixed. media.navigator.mediadatadecoder_vpx_enabled to true to enable hardware VA-API decoding for WebRTC. media.rdd-vpx.enabled to false to disable the remote data decoder process for VP8/VP9. image.webp.enabled to fasle to stop images from saving in WebP.
Enable VA-API in GStreamer
pacman-Syu gstreamer-vaapi gst-plugins-bad
Verify VA-API support
gst-inspect-1.0 vaapi
gst-inspect-1.0 nvcodec
issue
How to customize the tty login screen and SSH banner
# ~/.zshrc file for zsh interactive shells.
# see /usr/share/doc/zsh/examples/zshrc for examples
setopt autocd # change directory just by typing its name
setopt correct # auto correct mistakes
setopt interactivecomments # allow comments in interactive mode
setopt magicequalsubst # enable filename expansion for arguments of the form ‘anything=expression’
setopt nonomatch # hide error message if there is no match for the pattern
setopt notify # report the status of background jobs immediately
setopt numericglobsort # sort filenames numerically when it makes sense
setopt promptsubst # enable command substitution in prompt
WORDCHARS=${WORDCHARS//\/}# Don't consider certain characters part of the word
# hide EOL sign ('%')
PROMPT_EOL_MARK=""# configure key keybindings
bindkey-e# emacs key bindings
bindkey' ' magic-space # do history expansion on space
bindkey'^U' backward-kill-line # ctrl + U
bindkey'^[[3;5~'kill-word # ctrl + Supr
bindkey'^[[3~' delete-char # delete
bindkey'^[[1;5C' forward-word # ctrl + ->
bindkey'^[[1;5D' backward-word # ctrl + <-
bindkey'^[[5~' beginning-of-buffer-or-history# page up
bindkey'^[[6~' end-of-buffer-or-history# page down
bindkey'^[[H' beginning-of-line # home
bindkey'^[[F' end-of-line # end
bindkey'^[[Z' undo # shift + tab undo last action
bindkey"^R"history-incremental-search-backward # ctrl + r
bindkey"\e[A"history-beginning-search-backward # arrow up
bindkey"\e[B"history-beginning-search-forward # arrow down
# enable completion features
autoload-Uz compinit
compinit-d ~/.cache/zcompdump
zstyle':completion:*:*:*:*:*' menu select
zstyle':completion:*' auto-description 'specify: %d'zstyle':completion:*' completer _expand _complete
zstyle':completion:*' format 'Completing %d'zstyle':completion:*' group-name ''zstyle':completion:*' list-colors ''zstyle':completion:*' list-prompt %SAt %p: Hit TAB for more, or the character to insert%s
zstyle':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}'zstyle':completion:*' rehash true
zstyle':completion:*' select-prompt %SScrolling active: current selection at %p%s
zstyle':completion:*' use-compctl false
zstyle':completion:*' verbose true
zstyle':completion:*:kill:*'command'ps -u $USER -o pid,%cpu,tty,cputime,cmd'# Help command
autoload-Uz run-help((${+aliases[run-help]}))&&unalias run-help
alias help=run-help
autoload-Uz run-help-git run-help-ip run-help-openssl run-help-p4 run-help-sudo run-help-svk run-help-svn
# History configurations
HISTFILE=~/.zsh_history
HISTSIZE=1000SAVEHIST=2000setopt hist_expire_dups_first # delete duplicates first when HISTFILE size exceeds HISTSIZE
setopt hist_ignore_dups # ignore duplicated commands history list
setopt hist_ignore_space # ignore commands that start with space
setopt hist_verify # show command with history expansion to user before running it
#setopt share_history # share command history data
# force zsh to show the complete history
alias history="history 0"# configure `time` format
TIMEFMT=$'\nreal\t%E\nuser\t%U\nsys\t%S\ncpu\t%P'
# make less more friendly for non-text input files, see lesspipe(1)
#[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"
# set a fancy prompt (non-color, unless we know we "want" color)
case "$TERM" in
xterm-color|*-256color) color_prompt=yes;;
esac
# uncomment for a colored prompt, if the terminal has the capability; turned
# off by default to not distract the user: the focus in a terminal window
# should be on the output of commands, not on the prompt
force_color_prompt=yes
if [ -n "$force_color_prompt" ]; then
if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then
# We have color support; assume it's compliant with Ecma-48# (ISO/IEC-6429). (Lack of such support is extremely rare, and such
# a case would tend to support setf rather than setaf.)
color_prompt=yes
elsecolor_prompt=fificonfigure_prompt(){prompt_symbol=🤓
["$EUID"-eq 0]&&prompt_symbol=💀
case"$PROMPT_ALTERNATIVE" in
twoline)PROMPT=$'%F{%(#.blue.green)}┌──${:+($)─}${VIRTUAL_ENV:+($(basename $VIRTUAL_ENV))─}(%B%F{%(#.red.blue)}%n$prompt_symbol%m%b%F{%(#.blue.green)})-[%B%F{reset}%(6~.%-1~/…/%4~.%5~)%b%F{%(#.blue.green)}]\n└─%B%(#.%F{red}#.%F{blue}$)%b%F{reset} '
RPROMPT=$'%(?.. %? %F{red}%B⨯%b%F{reset})%(1j. %j %F{yellow}%B⚙%b%F{reset}.)'
;;
oneline)
PROMPT=$'${:+($)}${VIRTUAL_ENV:+($(basename$VIRTUAL_ENV))}%B%F{%(#.red.blue)}%n@%m%b%F{reset}:%B%F{%(#.blue.green)}%~%b%F{reset}%(#.#.$) '
RPROMPT=;;backtrack)PROMPT=$'${:+($)}${VIRTUAL_ENV:+($(basename$VIRTUAL_ENV))}%B%F{red}%n@%m%b%F{reset}:%B%F{blue}%~%b%F{reset}%(#.#.$) '
RPROMPT=;;esac}# The following block is surrounded by two delimiters.
# These delimiters must not be modified. Thanks.
# START CONFIG VARIABLES
PROMPT_ALTERNATIVE=twoline
NEWLINE_BEFORE_PROMPT=yes
# STOP CONFIG VARIABLES
if["$color_prompt"= yes ];then# override default virtualenv indicator in prompt
VIRTUAL_ENV_DISABLE_PROMPT=1configure_prompt# enable syntax-highlighting
if[-f /usr/share/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh ]&&["$color_prompt"= yes ];then . /usr/share/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
ZSH_HIGHLIGHT_HIGHLIGHTERS=(mainbrackets pattern)ZSH_HIGHLIGHT_STYLES[default]=none
ZSH_HIGHLIGHT_STYLES[unknown-token]=fg=red,bold
ZSH_HIGHLIGHT_STYLES[reserved-word]=fg=cyan,bold
ZSH_HIGHLIGHT_STYLES[suffix-alias]=fg=green,underline
ZSH_HIGHLIGHT_STYLES[global-alias]=fg=magenta
ZSH_HIGHLIGHT_STYLES[precommand]=fg=green,underline
ZSH_HIGHLIGHT_STYLES[commandseparator]=fg=blue,bold
ZSH_HIGHLIGHT_STYLES[autodirectory]=fg=green,underline
ZSH_HIGHLIGHT_STYLES[path]=underline
ZSH_HIGHLIGHT_STYLES[path_pathseparator]=ZSH_HIGHLIGHT_STYLES[path_prefix_pathseparator]=ZSH_HIGHLIGHT_STYLES[globbing]=fg=blue,bold
ZSH_HIGHLIGHT_STYLES[history-expansion]=fg=blue,bold
ZSH_HIGHLIGHT_STYLES[command-substitution]=none
ZSH_HIGHLIGHT_STYLES[command-substitution-delimiter]=fg=magenta
ZSH_HIGHLIGHT_STYLES[process-substitution]=none
ZSH_HIGHLIGHT_STYLES[process-substitution-delimiter]=fg=magenta
ZSH_HIGHLIGHT_STYLES[single-hyphen-option]=fg=magenta
ZSH_HIGHLIGHT_STYLES[double-hyphen-option]=fg=magenta
ZSH_HIGHLIGHT_STYLES[back-quoted-argument]=none
ZSH_HIGHLIGHT_STYLES[back-quoted-argument-delimiter]=fg=blue,bold
ZSH_HIGHLIGHT_STYLES[single-quoted-argument]=fg=yellow
ZSH_HIGHLIGHT_STYLES[double-quoted-argument]=fg=yellow
ZSH_HIGHLIGHT_STYLES[dollar-quoted-argument]=fg=yellow
ZSH_HIGHLIGHT_STYLES[rc-quote]=fg=magenta
ZSH_HIGHLIGHT_STYLES[dollar-double-quoted-argument]=fg=magenta
ZSH_HIGHLIGHT_STYLES[back-double-quoted-argument]=fg=magenta
ZSH_HIGHLIGHT_STYLES[back-dollar-quoted-argument]=fg=magenta
ZSH_HIGHLIGHT_STYLES[assign]=none
ZSH_HIGHLIGHT_STYLES[redirection]=fg=blue,bold
ZSH_HIGHLIGHT_STYLES[comment]=fg=black,bold
ZSH_HIGHLIGHT_STYLES[named-fd]=none
ZSH_HIGHLIGHT_STYLES[numeric-fd]=none
ZSH_HIGHLIGHT_STYLES[arg0]=fg=green
ZSH_HIGHLIGHT_STYLES[bracket-error]=fg=red,bold
ZSH_HIGHLIGHT_STYLES[bracket-level-1]=fg=blue,bold
ZSH_HIGHLIGHT_STYLES[bracket-level-2]=fg=green,bold
ZSH_HIGHLIGHT_STYLES[bracket-level-3]=fg=magenta,bold
ZSH_HIGHLIGHT_STYLES[bracket-level-4]=fg=yellow,bold
ZSH_HIGHLIGHT_STYLES[bracket-level-5]=fg=cyan,bold
ZSH_HIGHLIGHT_STYLES[cursor-matchingbracket]=standout
fielsePROMPT='${:+($)}%n@%m:%~%# 'fiunsetcolor_prompt force_color_prompt
toggle_oneline_prompt(){if["$PROMPT_ALTERNATIVE"= oneline ];thenPROMPT_ALTERNATIVE=twoline
elsePROMPT_ALTERNATIVE=oneline
ficonfigure_promptzle reset-prompt
}zle-N toggle_oneline_prompt
bindkey^P toggle_oneline_prompt
# If this is an xterm set the title to user@host:dir
case"$TERM" in
xterm*|rxvt*|Eterm|aterm|kterm|gnome*|alacritty)TERM_TITLE=$'\e]0;${:+($)}${VIRTUAL_ENV:+($(basename$VIRTUAL_ENV))}%n@%m: %~\a'
;;
*)
;;
esac
precmd() {
# Print the previously configured title
print -Pnr -- "$TERM_TITLE"
# Print a new line before the prompt, but only if it is not the first line
if [ "$NEWLINE_BEFORE_PROMPT" = yes ]; then
if [ -z "$_NEW_LINE_BEFORE_PROMPT" ]; then
_NEW_LINE_BEFORE_PROMPT=1
else
print ""
fi
fi
}
# This is where you put your hand rolled scripts (remember to chmod them)
PATH="$HOME/bin:$PATH"
# enable color support of ls, less and man, and also add handy aliases
if [ -x /usr/bin/dircolors ]; then
test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
alias ls='ls --color=auto'
#alias dir='dir --color=auto'
#alias vdir='vdir --color=auto'
alias grep='grep --color=auto'
alias fgrep='fgrep --color=auto'
alias egrep='egrep --color=auto'
alias diff='diff --color=auto'
alias ip='ip --color=auto'
export LESS_TERMCAP_mb=$'\E[1;31m' # begin blink
export LESS_TERMCAP_md=$'\E[1;36m' # begin bold
export LESS_TERMCAP_me=$'\E[0m' # reset bold/blink
export LESS_TERMCAP_so=$'\E[01;33m' # begin reverse video
export LESS_TERMCAP_se=$'\E[0m' # reset reverse video
export LESS_TERMCAP_us=$'\E[1;32m' # begin underline
export LESS_TERMCAP_ue=$'\E[0m' # reset underline
# Take advantage of $LS_COLORS for completion as well
zstyle ':completion:*' list-colors "${(s.:.)LS_COLORS}"
zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#)*=0=01;31'
fiif["$TERM"="linux"];thenecho-en "\e]P0000000"# background
echo-en "\e]P87f7f7f"# grey
echo-en "\e]P1cc0000"# red
echo-en "\e]P9cc0000"# lightred
echo-en "\e]P2a2e22e"# green
echo-en "\e]PAa2e22e"# lightgreen
echo-en "\e]P3ffb000"# yellow
echo-en "\e]PBffb000"# lightyellow
echo-en "\e]P4007acc"# blue
echo-en "\e]PC007acc"# lightblue
echo-en "\e]P5d4038a"# magenta
echo-en "\e]PDd4038a"# lightmagenta
echo-en "\e]P670b596"# cyan
echo-en "\e]PE70b596"# lightcyan
echo-en "\e]P7a5a5a5"# text
echo-en "\e]PFcacecd"# white
clear# for background artifacting
fi# Aliases
alias ls='ls -h --color=auto'alias ll='ls -alh --color=auto'alias la='ls -Ah --color=auto'alias l='ls -CFlh --color=auto'alias diff='diff --color=auto'alias dir='dir --color=auto'alias vdir='vdir --color=auto'alias grep='grep --color=auto'alias fgrep='fgrep --color=auto'alias egrep='egrep --color=auto'alias ..='cd ..'alias ...='cd ../..'alias s='ssh -l root'alias reboot="systemctl reboot"alias shutdown='shutdown now'alias cp='cp -iv'alias mv='mv -iv'alias rm='rm -rfv'alias df='df -h'alias free='free -m'alias sudo='sudo 'alias clear='clear && neofetch'alias rsync='rsync -avhP'# This is GOLD for finding out what is taking so much space on your drives!
alias diskspace="du -S | sort -n -r |more"# Command line mplayer movie watching for the win.
alias mp="mplayer -fs"# Show me the size (sorted) of only the folders in this directory
alias folders="find . -maxdepth 1 -type d -print | xargs du -sk | sort -rn"# enable auto-suggestions based on the history
source /usr/share/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
source /usr/share/zsh/plugins/zsh-autosuggestions/zsh-autosuggestions.zsh
ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE='fg=#ffb000'# pacman -F "command not found" handler
functioncommand_not_found_handler {localpurple='\e[1;35m'bright='\e[0;1m'green='\e[1;32m'reset='\e[0m'printf'zsh: command not found: %s\n'"$1"localentries=(${(f)"$(/usr/bin/pacman -F --machinereadable -- "/usr/bin/$1")"})if((${#entries[@]} ))
thenprintf"${bright}$1${reset} may be found in the following packages:\n"local pkg
forentryin"${entries[@]}"do# (repo package version file)
localfields=(${(0)entry})if[["$pkg" !="${fields[2]}"]]thenprintf"${purple}%s/${bright}%s ${green}%s${reset}\n""${fields[1]}""${fields[2]}""${fields[3]}"fiprintf' /%s\n'"${fields[4]}"pkg="${fields[2]}"donefi}# source /usr/share/doc/pkgfile/command-not-found.zsh
# color man pages
man(){envLESS_TERMCAP_mb=$'\E[01;31m' \
LESS_TERMCAP_md=$'\E[01;38;5;74m' \
LESS_TERMCAP_me=$'\E[0m' \
LESS_TERMCAP_se=$'\E[0m' \
LESS_TERMCAP_so=$'\E[38;5;246m' \
LESS_TERMCAP_ue=$'\E[0m' \
LESS_TERMCAP_us=$'\E[04;38;5;146m' \
man"$@"}# Saving ssh passphrase for this session
if[ ! -S ~/.ssh/ssh_auth_sock ];theneval `ssh-agent`
ln-sf"$SSH_AUTH_SOCK" ~/.ssh/ssh_auth_sock
fiexportSSH_AUTH_SOCK=~/.ssh/ssh_auth_sock
ssh-add-l> /dev/null ||ssh-addcd$HOME
Alacritty
How to install and configure Alacritty, a fast, cross-platform, OpenGL terminal emulator
Installation
pacman-Syu alacritty
Configuration
~/.config/alacritty.yml
# Configuration for Alacritty, the GPU enhanced terminal emulator.
env:
TERM: xterm-256color
window:
# Window dimensions (changes require restart)
#
# Specified in number of columns/lines, not pixels.
# If both are `0`, this setting is ignored.
dimensions:
columns: 128lines: 24# Window position (changes require restart)
#
# Specified in number of pixels.
# If the position is not set, the window manager will handle the placement.
position:
x: 3836y: 4# Background opacity
#
# Window opacity as a floating point number from `0.0` to `1.0`.
# The value `0.0` is completely transparent and `1.0` is opaque.
opacity: 0.8# Font configuration
font:
# Normal (roman) font face
normal:
# Font family
#
# Default:
# - (macOS) Menlo
# - (Linux/BSD) monospace
# - (Windows) Consolas
family: JetBrains Mono
# The `style` can be specified to pick a specific face.
style: Regular
# Bold font face
bold:
# Font family
#
# If the bold family is not specified, it will fall back to the
# value specified for the normal font.
family: JetBrains Mono
# The `style` can be specified to pick a specific face.
style: Bold
# Italic font face
italic:
# Font family
#
# If the italic family is not specified, it will fall back to the
# value specified for the normal font.
family: JetBrains Mono
# The `style` can be specified to pick a specific face.
style: Italic
# Bold italic font face
bold_italic:
# Font family
#
# If the bold italic family is not specified, it will fall back to the
# value specified for the normal font.
family: JetBrains Mono
# The `style` can be specified to pick a specific face.
style: Bold Italic
# Point size
size: 11.0selection:
#semantic_escape_chars: ",│`|:\"' ()[]{}<>\t"
# When set to `true`, selected text will be copied to the primary clipboard.
save_to_clipboard: false
# Allow terminal applications to change Alacritty's window title.
#dynamic_title: true
cursor:
# Cursor style
#
# Values for `style`:
# - ▇ Block
# - _ Underline
# - | Beam
style:
blinking: Always
blink_interval: 500key_bindings:
- { key: F, mods: Control, action: SearchForward }- { key: C, mods: Control, action: Copy }- { key: V, mods: Control, action: Paste }colors:
# Default colors
primary:
# background: '#ffffff'
# foreground: '#222222'
background: '#000000'# background: '#111213'
foreground: '#cacecd'# Normal colors
normal:
black: '#222222'red: '#cc0000'green: '#a2e22e'yellow: '#ffb000'blue: '#007acc'magenta: '#d4038a'cyan: '#70b596'white: '#ffffff'# Bright colors
bright:
black: '#7f7f7f'red: '#cc0000'green: '#a2e22e'yellow: '#ffb000'blue: '#007acc'magenta: '#d4038a'cyan: '#70b596'white: '#ffffff'
SSH
How to setup Secure Shell Protocol public key authentication
# localhost configuration
# Edit SSH Configuration
AddressFamily inet
PermitRootLogin no
MaxAuthTries3PubkeyAuthentication no
PasswordAuthentication no
PermitEmptyPasswords no
AllowTcpForwarding no
X11Forwarding no
KbdInteractiveAuthentication no
UsePAM no
PrintMotd no
KerberosAuthentication no
GSSAPIAuthentication no
# Overriding settings on a per-user basis
Match User root Address 127.0.0.1PermitRootLogin prohibit-password
PubkeyAuthentication yes
AuthenticationMethods publickey
AllowTcpForwarding yes
Banner /etc/issue.net
Saving ssh passphrase for current session on client
.zshrc
# Saving ssh passphrase for current session
if[ ! -S ~/.ssh/ssh_auth_sock ];theneval `ssh-agent`
ln-sf"$SSH_AUTH_SOCK" ~/.ssh/ssh_auth_sock
fiexportSSH_AUTH_SOCK=~/.ssh/ssh_auth_sock
ssh-add-l> /dev/null ||ssh-add
VNC
How to connect to a remote desktop environment with VNC graphical desktop-sharing system
Install VNC server
pacman-Syu tigervnc
Create a password
vncpasswd
Define user mappings
/etc/tigervnc/vncserver.users
# TigerVNC User assignment
#
# This file assigns users to specific VNC display numbers.
# The syntax is <display>=<username>. E.g.:
#
# :2=andrew
# :3=lisa
:1=user
Each user defined in this file will have a corresponding port on which its session will run.
The number in the file corresponds to a TCP port. By default, :1 is TCP port 5901 (5900+1).
If another parallel server is needed, a second instance can then run on the next highest,
free port, i.e 5902 (5900+2).
Determine the number of hugepages needed.
Huge pages will be automatically allocated, and freed after VM stops.
Check the size of the hugepages
grep Hugepagesize /proc/meminfo
Tip
It is hardly recommended to drop caches, compact memory and wait couple of seconds before starting VM, as there could be not enough free contiguous memory for required huge pages blocks. Especially after some uptime of the host system.
echo3> /proc/sys/vm/drop_caches
echo1> /proc/sys/vm/compact_memory
Virt-manager
Make sure that Chipset: Q35 is selected.
Under Firmware, select the 64 bit UEFI firmware UEFI x86_64: OVMF_CODE.fd
Script to disable USB autosuspend for mouse and keyboard
~/bin/usbautosuspend
#!/bin/sh
# Disable USB autosuspend for mouse and keyboard
sleep5;# Corsair Harpoon Wireless Dongle
MOUSE="/sys/bus/usb/devices/usb1/1-2/power/control";# SteelSeries ApS SteelSeries Apex M750 TKL
KEYBOARD="/sys/bus/usb/devices/usb1/1-4/1-4.1/power/control";if[-f "$MOUSE"];thenecho'on'|sudotee cat $MOUSE;fiif[-f "$KEYBOARD"];thenecho'on'|sudotee cat $KEYBOARD;fi
chmod700 ~/bin/usbautosuspend
Service to automate the process on startup
/etc/systemd/system/usbautosuspend.service
[Unit]Description=Disable USB autosuspend for mouse and keyboard[Service]ExecStart=/home/USER/bin/usbautosuspend
[Install]WantedBy=multi-user.target
systemctl enable usbautosuspend.service
Flash android factory image
How to flash an android factory image and uninstall bloat packages without rooting the phone
Install package
pacman-Syu android-tools
Enable Developer Mode
Connect your phone to your computer.
Launch the Settings app > About phone
Tap build number seven times.
Enable USB Debugging
Settings > System > Developer options > enable USB Debugging
Authorize your computer connection on your phone when the prompt comes up on your phone,
if this is the first time you are connecting with this ADB computer.
Unlock bootloader
Settings > Developer Options > enable OEM unlocking
Reboot the phone into Fastboot mode.
adb reboot bootloader
fastboot flashing unlock
Vol up to select option on phone > press power button to confirm
After reboot press power button to start.
Retain personal data by deleting the “-w” wipe attribute from the command within the script.
To avoid compatibility issues, a data wipe is recommended though.
./flash-all.sh
Once the script finishes, your device will reboot into the new OS.
Vol up to select option on phone > press power button to confirm.
After reboot press power button to start.
Settings > Developer Options > disable OEM unlocking
If you use it in client mode, it’s similar to telnet, and you can create a TCP connection to a specific port and send anything that you type.
You can also use it to open a TCP/IP port and read from standard input.
That makes it an easy way to transfer files between two computers.
Another use case is testing whether your firewall is blocking certain traffic. For example,
execute netcat in server mode on a host behind your firewall and then execute netcat in client mode from outside the firewall.
If you can read on the server whatever you type on the client, then the firewall is not filtering the connection.
ncat-l-p<port>
This executes Netcat in server mode on port and waits for incoming connections.
ncat-lnvp<port>-s<network-ID>
ncat<network-ID><port>
This executes Netcat in client mode and connects to TCP port on remote host .
You can also use Netcat with pipe commands. For example you can compress a file before sending it to the remote host with Netcat.
tar cpf - /some/dir |compress-c|ncat-w3<network-ID><port>
Subnetting
List of IPv4 and IPv6 ranges, subnet size tables and special address types
Calculate subnet masks
ipcalc10.0.0.1/22-s254254254254
IPv4 ranges
Scope
Class
First
Last
Netmask
Public
A
1.0.0.0
126.255.255.255
255.0.0.0
Public
B
128.0.0.0
192.255.0.0
255.255.0.0
Public
C
192.0.0.0
223.255.255.0
255.255.255.0
Public
D
224.0.0.0
239.255.255.255
Public
E
240.0.0.0
255.255.255.255
Private
A
10.0.0.0
10.255.255.255
255.0.0.0
Private
B
172.16.0.0
172.31.255.255
255.255.0.0
Private
C
192.168.0.0
192.168.255.255
255.255.255.0
Special address types
Type
CIDR
IPv4
IPv6
Default
0.0.0.0/0
0.0.0.0
::
Loopback (localhost)
127.0.0.0/8
127.0.0.1 - 127.255.255.254
::1
Link-local
169.254.0.0/16
169.254.0.1 - 169.254.255.254
FE80::/64
Global broadcast
255.255.255.255
using multicast
Multicast
224.0.0.0/4
224.0.0.0 - 224.0.0.255
FF00::/8
Unique Local Unicast
FC00::/7 FD00::/8
IPv6 Anycast
Routers direct packets addressed to this destination to the location nearest the sender
Anycast-addresses may have any random prefix and are formally indistinguishable from unicast addresses
IPv4 subnet sizes
IPv4 CIDR mask
Dotted decimal mask
Amount of usable host addresses
/1
128.0.0.0
2147483646
/2
192.0.0.0
1073741822
/3
224.0.0.0
536870910
/4
240.0.0.0
268435454
/5
248.0.0.0
134217726
/6
252.0.0.0
67108862
/7
254.0.0.0
33554430
/8
255.0.0.0
16777214
/9
255.128.0.0
8388606
/10
255.192.0.0
4194302
/11
255.224.0.0
2097150
/12
255.240.0.0
1048574
/13
255.248.0.0
524286
/14
255.252.0.0
262142
/15
255.254.0.0
131070
/16
255.255.0.0
65534
/17
255.255.128.0
32766
/18
255.255.192.0
16382
/19
255.255.224.0
8190
/20
255.255.240.0
4094
/21
255.255.248.0
2046
/22
255.255.252.0
1022
/23
255.255.254.0
510
/24
255.255.255.0
254
/25
255.255.255.128
126
/26
255.255.255.192
62
/27
255.255.255.224
30
/28
255.255.255.240
14
/29
255.255.255.248
6
/30
255.255.255.252
2
/31
255.255.255.254
no net, 2 hosts
/32
255.255.255.255
no net, one host
IPv6 subnet sizes
IPv6 CIDR mask
Amount of networks or addresses
/1
9223372036854775808 networks of size /64
/2
4611686018427387904 networks of size /64
/3
2305843009213693952 networks of size /64
/4
1152921504606846976 networks of size /64
/5
576460752303423488 networks of size /64
/6
288230376151711744 networks of size /64
/7
144115188075855872 networks of size /64
/8
72057594037927936 networks of size /64
/9
36028797018963968 networks of size /64
/10
18014398509481984 networks of size /64
/11
9007199254740992 networks of size /64
/12
4503599627370496 networks of size /64
/13
2251799813685248 networks of size /64
/14
1125899906842624 networks of size /64
/15
562949953421312 networks of size /64
/16
281474976710656 networks of size /64
/17
140737488355328 networks of size /64
/18
70368744177664 networks of size /64
/19
35184372088832 networks of size /64
/20
17592186044416 networks of size /64
/21
8796093022208 networks of size /64
/22
4398046511104 networks of size /64
/23
2199023255552 networks of size /64
/24
1099511627776 networks of size /64
/25
549755813888 networks of size /64
/26
274877906944 networks of size /64
/27
137438953472 networks of size /64
/28
68719476736 networks of size /64
/29
34359738368 networks of size /64
/30
17179869184 networks of size /64
/31
8589934592 networks of size /64
/32
4294967296 networks of size /64
/33
2147483648 networks of size /64
/34
1073741824 networks of size /64
/35
536870912 networks of size /64
/36
268435456 networks of size /64
/37
134217728 networks of size /64
/38
67108864 networks of size /64
/39
33554432 networks of size /64
/40
16777216 networks of size /64
/41
8388608 networks of size /64
/42
4194304 networks of size /64
/43
2097152 networks of size /64
/44
1048576 networks of size /64
/45
524288 networks of size /64
/46
262144 networks of size /64
/47
131072 networks of size /64
/48
65536 networks of size /64
/49
32768 networks of size /64
/50
16384 networks of size /64
/51
8192 networks of size /64
/52
4096 networks of size /64
/53
2048 networks of size /64
/54
1024 networks of size /64
/55
512 networks of size /64
/56
256 networks of size /64
/57
128 networks of size /64
/58
64 networks of size /64
/59
32 networks of size /64
/60
16 networks of size /64
/61
8 networks of size /64
/62
4 networks of size /64
/63
2 networks of size /64
/64
18446744073709551616 addresses
/65
9223372036854775808 addresses
/66
4611686018427387904 addresses
/67
2305843009213693952 addresses
/68
1152921504606846976 addresses
/69
576460752303423488 addresses
/70
288230376151711744 addresses
/71
144115188075855872 addresses
/72
72057594037927936 addresses
/73
36028797018963968 addresses
/74
18014398509481984 addresses
/75
9007199254740992 addresses
/76
4503599627370496 addresses
/77
2251799813685248 addresses
/78
1125899906842624 addresses
/79
562949953421312 addresses
/80
281474976710656 addresses
/81
140737488355328 addresses
/82
70368744177664 addresses
/83
35184372088832 addresses
/84
17592186044416 addresses
/85
8796093022208 addresses
/86
4398046511104 addresses
/87
2199023255552 addresses
/88
1099511627776 addresses
/89
549755813888 addresses
/90
274877906944 addresses
/91
137438953472 addresses
/92
68719476736 addresses
/93
34359738368 addresses
/94
17179869184 addresses
/95
8589934592 addresses
/96
4294967296 addresses
/97
2147483648 addresses
/98
1073741824 addresses
/99
536870912 addresses
/100
268435456 addresses
/101
134217728 addresses
/102
67108864 addresses
/103
33554432 addresses
/104
16777216 addresses
/105
8388608 addresses
/106
4194304 addresses
/107
2097152 addresses
/108
1048576 addresses
/109
524288 addresses
/110
262144 addresses
/111
131072 addresses
/112
65536 addresses
/113
32768 addresses
/114
16384 addresses
/115
8192 addresses
/116
4096 addresses
/117
2048 addresses
/118
1024 addresses
/119
512 addresses
/120
256 addresses
/121
128 addresses
/122
64 addresses
/123
32 addresses
/124
16 addresses
/125
8 addresses
/126
4 addresses
/127
2 addresses
/128
1 address
Determine the necessary network mask for the network size in CIDR notation
255 . 255 . 252 . 0
100 fits in 2^7 = 128 32-7= /25
14000 fits in 2^14 = 16384 32-14= /18
3789 fits in 2^12 = 4096 32-12=/20
Gaming
How to install Steam, DXVK
Steam Launch Options
DO=(%command%); “${DO[@]/%FalloutNVLauncher.exe/FalloutNV.exe}”
Enable GameMode
LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libgamemodeauto.so
Disable ESYNC
PROTON_NO_ESYNC=1
Disable DX11 or 10
PROTON_NO_D3D11=1
Get Cool States
DXVK_HUD=fps,frametimes
DXVK Other options: devinfo, submissions, drawcalls, pipelines, memory, version, api
Always end with this command
%command%
nVidia Caching options
__GL_THREADED_OPTIMIZATION=1
__GL_SHADER_DISK_CACHE_PATH=/path/to/location
You must manually request GameMode when running the game.
This can be done by launching the game through gamemoderun
gamemoderun ./game
Or edit the Steam launch options
gamemoderun %command%
Lutris
find /usr/ -name libgamemodeauto.so
Lutris Values