# gnu/linux system setup and usage examples most of this setup stood the test of time and still shows its value every day. ## boot and login - linux, xserver, bash linux booting to a login console, which executes .bash_profile and startx to start an xserver instance which executes .xinitrc. on login, a luks partition or file /home/.{username} is decrypted and mounted to /home/{username} using [pam_mount](https://inai.de/projects/pam_mount/). then ~/.bash_profile starts xserver which starts the window manager ## window manager - dwm [dwm](http://dwm.suckless.org/) handles the arrangement of xserver windows ([screenshot](images/desktop-example.png)), configured to draw no borders and with a monospace font. dwm-show-info from sph-script for time and date displayed ## starting programs - xbindkeys the most important commands bound to f keys. * F4 opens dmenu_run, an input field line appearing at the top of the screen where a command can be entered with autocomplete and run * example bindings: f1 web browser, f2 file manager, f3 terminal, f5 dmenu, f6 screenshot ## virtual terminal - st, screen [st](https://st.suckless.org/) started with a screen session for tabs/multiplexing in any environment. `st -e screen`. `ctrl+a c` creates new terminal buffers, `ctrl+a p` and `ctrl+a n` switch between them. this is extremely fast, works on other systems and terminals and shows that virtual terminals do not need to support tabs * [custom color scheme for ls](../designs/more/ls-color-scheme.md) * font: "Gohu GohuFont:pixelsize=14:antialias=false" ## important custom shell commands * fig: search for files containing all of the given keywords * search: search for files with lines that contain all the given keywords and display file names * searchl: search for files with lines that contain all the given keywords and display lines and file names * nargs: execute commands for each newline-separated line read from standard input, xargs * group: move selected files into a new directory. a dialog pops up where the new directory name can be entered * move-up: move selected files into the parent directory * splice: files of the selected directories are moved into the current directory and the selected directories removed. duplicate file names are automatically renamed * rate 0, rate 1, rate 2, rate 3, rate 4, and rate 5: for moving files and directory structures under numeric rating directories * unpack: unpack archives with the unp utility * mount-home: mount one or more sources to $HOME/mnt/{automatically-chosen-directory} * collect-file: symlink (same filesystem) or copy (different filesystem) selected files into $HOME/collections/yyyy-mm-dd * repl: make an input field for any command and keep executing it with user supplied arguments * see also [sph-script](https://github.com/sph-mn/sph-script) ## other customizations * cursor blinking disabled for the console, virtual terminal, and programs using graphical programming frameworks gtk2.0, gtk3.0, and qt. ([tty-no-cursor-blink](https://github.com/atweiden/tty-no-cursor-blink), there is an aur package for that) * files are initially created as only readable by the creator, this is achieved by using a default umask of 077. some systems give all users read access to created files * [xmodmap](https://wiki.archlinux.org/index.php/Xmodmap) to make the right shift-key work as the meta key and to disable the shift-lock key * custom x11 keyboard-layout to use the qgmlwb layout and an additional dead-key (a key that only modifies a subsequent key) for diaresis on the circumflex key * versioned system configuration: git and symlinks * user name: nonroot ## file manager - thunar custom right-click commands: extensive use of thunars easily configurable custom right click commands. for example: group, move-up, splice, rate, unpack, collect-file batch renaming: when multiple files are selected, right-click -> rename will open a featureful batch renamer which can also be started with "thunar -B", "thunar -B *", "find . | thunar -B" ## linux distribution: arch linux * it keeps packages as they are made by upstream. not like debian, which makes extensive changes to programs to make them debian specific and require debian dependent knowledge * comes installed with a minimum * always get the current version of packages, that went through a public testing phase in a testing repository. avoids having to manually compile things because you need a version that is already six months old and not in the repositories for your distribution version that will never be updated. on ubuntu you might spent a lot of time searching and compiling newer version of software yourself, for example new drivers and kernels if you bought a new graphics card. also avoids risky full distro upgrades, they just do not exist because the system updates gradually with each package update. manual intervention is rarely required, and if then only on important big changes like the switch to systemd or demanded by upstream developers of the used software * the package manager is a relief, in comparison to apt-get/apt-cache/dpkg. finally an efficient to use program that is fast and gives terse and clear output. packages are very easy to create, the only thing needed is basically a bash script that does the compile and installation steps. users can upload packages to the separate arch user repository. official packages are signed * on one workstation i have been running the same arch system for 8 years, which started as a 32bit system and was in-place converted to 64bit. arch can also be in-place converted into parabola linux, which is fsf endorsed * used as a base system for steamos, the operating of the steam deck # custom shell prompt basename of the current directory on its own line in magenta ~~~ ~ echo test test ~ cd /usr/bin bin ls guile guile bin ~~~ # example configuration files ~/.bash_profile ~~~ if test "$(tty)" == /dev/tty1 then exec startx fi ~~~ ~/.xinitrc ~~~ xmodmap /home/nonroot/.xmodmap xbindkeys & st -e screen & dwm ~~~ ~/.xbindkeysrc.scm ~~~ (xbindkey (quote (F1)) "firefox") (xbindkey (quote (F2)) "thunar") (xbindkey (quote (F3)) "st -e screen") (xbindkey (quote (F4)) "dmenu_run") (xbindkey (quote (F5)) "screenshot") ~~~ ~/.xmodmap ~~~ remove lock = Caps_Lock remove shift = Shift_R Shift_L add mod1 = Shift_R remove mod1 = Alt_L Alt_R keycode 0x5e = parenleft grave ~~~ /etc/bash.bashrc ~~~ # custom colors for ls # light #LS_COLORS='rs=0:di=04;30:ln=01;30:pi=34;01:so=00:do=00:bd=40;33;01:cd=00:or=01;31:su=00:sg=00:tw=00:ow=00;30:st=00:ex=40;37:*.tar=00;33:*.tgz=00;33:*.lzma=00;33:*.zip=00;33:*.z=00;33:*.gz=00;33:*.bz2=00;33:*.bz=00;33:*.tbz2=00;33:*.tz=00;33:*.deb=00;33:*.rpm=00;33:*.jar=00;33:*.rar=00;33:*.cpio=00;33:*.7z=00;33:*.jpg=00;32:*.jpeg=00;32:*.gif=00;32:*.bmp=00;32:*.tif=00;32:*.tiff=00;32:*.png=00;32:*.svg=00;32:*.svgz=00;32:*.xcf=00;32:*.pcx=00;32:*.mov=00;36:*.mpg=00;36:*.mpeg=00;36:*.m2v=00;36:*.mkv=00;36:*.ogm=00;36:*.mp4=00;36:*.m4v=00;36:*.vob=00;36:*.wmv=00;36:*.asf=00;36:*.avi=00;36:*.flv=00;36:*.aac=00;35:*.flac=00;35:*.mid=00;35:*.midi=00;35:*.mka=00;35:*.mp3=00;35:*.mpc=00;35:*.ogg=00;35:*.wav=00;35:*.scm=00;34:*.rb=00;31:*.txt=00;30:*.pdf=00;34:*.doc=00;34:'; # dark export LS_COLORS='rs=0:di=04;37:ln=01;37:pi=34;01:so=00:do=00:bd=40;33;01:cd=00:or=00;31:su=00:sg=00:tw=00:ow=00;37:st=00:ex=00;37:*.tar=00;33:*.tgz=00;33:*.xz=00;33:*.lzma=00;33:*.zip=00;33:*.tar.zst=00;33:*.z=00;33:*.gz=00;33:*.bz2=00;33:*.bz=00;33:*.tbz2=00;33:*.tz=00;33:*.deb=00;33:*.rpm=00;33:*.jar=00;33:*.rar=00;33:*.cpio=00;33:*.7z=00;33:*.jpg=00;32:*.jpeg=00;32:*.gif=00;32:*.bmp=00;32:*.tif=00;32:*.tiff=00;32:*.png=00;32:*.svg=00;32:*.svgz=00;32:*.xcf=00;32:*.pcx=00;32:*.mov=00;36:*.mpg=00;36:*.mpeg=00;36:*.m2v=00;36:*.mkv=00;36:*.ogm=00;36:*.mp4=00;36:*.m4v=00;36:*.vob=00;36:*.wmv=00;36:*.asf=00;36:*.avi=00;36:*.flv=00;36:*.aac=00;35:*.flac=00;35:*.mid=00;35:*.midi=00;35:*.mka=00;35:*.mp3=00;35:*.mpc=00;35:*.ogg=00;35:*.wav=00;35:*.scm=00;37:*.rb=00;31:*.txt=00;37:*.pdf=00;37:*.doc=00;37:'; export HISTCONTROL='ignoreboth:erasedups' # ignore duplicate commands from shell history export TERM=xterm-256color # make most terminals use 256 colors export PS1="\e[0;35m\W\e[m\n " # set the prompt export PROMPT_COMMAND='echo -ne "\033]0;${HOSTNAME}\007"' # terminal window title export EDITOR=nano umask 0077 # relatively restrictive default permissions for new files (600) unset HISTFILE # disable the .bash_history file. cycling through previous commands of the current session still works ~~~ ~/.config/gtk-3.0/settings.ini ~~~ [Settings] gtk-theme-name=Windows-10-Dark gtk-icon-theme-name=HighContrast gtk-font-name=Cantarell 11 gtk-cursor-theme-name=Adwaita gtk-cursor-theme-size=0 gtk-cursor-blink = false gtk-toolbar-style=GTK_TOOLBAR_BOTH_HORIZ gtk-toolbar-icon-size=GTK_ICON_SIZE_LARGE_TOOLBAR gtk-button-images=0 gtk-menu-images=0 gtk-enable-event-sounds=0 gtk-enable-input-feedback-sounds=0 gtk-xft-antialias=1 gtk-xft-hinting=1 gtk-xft-hintstyle=hintmedium ~~~ ~/.gtkrc-2.0 can be managed with lxappearance. ~~~ gtk-cursor-blink = 0 include "/home/nonroot/.gtkrc-2.0.mine" gtk-theme-name="Windows-10-Dark" gtk-icon-theme-name="HighContrast" gtk-font-name="Cantarell 11" gtk-cursor-theme-name="Adwaita" gtk-cursor-theme-size=0 gtk-toolbar-style=GTK_TOOLBAR_BOTH_HORIZ gtk-toolbar-icon-size=GTK_ICON_SIZE_LARGE_TOOLBAR gtk-button-images=0 gtk-menu-images=0 gtk-enable-event-sounds=0 gtk-enable-input-feedback-sounds=0 gtk-xft-antialias=1 gtk-xft-hinting=1 gtk-xft-hintstyle="hintmedium" ~~~ ~/.config/qt6ct/qt6ct.conf, ~/.config/qt6ct/qt5ct.conf ~~~ [Interface] cursor_flash_time=0 ~~~ # versioned system configuration stored in a git repository with a file structure like this ~~~ data {hostname} ... {root-relative-full-paths} ~~~ symlinked to target destinations with "cp -rst / $PWD/data/hostname/*" # linux tips * `info coreutils` * try to open manual pages for programs or configuration files you want to learn about. example: man locale.conf * keybindings on the terminal * ctrl+l clear screen * ctrl+c quit process, sends the sigint signal * ctrl+d exit * for ensuring permissions one may create, and regularly run, a script where the desired filesystem permissions are applied with commands like chmod. unanticipated permission changes are otherwise unlikely to be noticed * [software list](/foreign/software-list.html) ## reading live updates from logfiles and other text files tail -f displays lines from the end of files and continues to display live future updates - so you can wait and see updates in real-time ~~~ tail -f /var/log/mylogfile ~~~ -n specifies the number of last lines to show at first ~~~ tail -n 400 -f /var/log/mylogfile ~~~ it can be filtered ~~~ tail -f |grep myfilterstring ~~~ live updates of multiple files: ~~~ tail -f /var/log/mylogfile /var/log/another-file /var/log/and-another-file ~~~ ## regular task execution, task scheduling with cron ### cron configuration format see [here](http://en.wikipedia.org/wiki/Cron#Format) ### example line 0 */12 * * * /usr/bin/redmine-update-repositories * "*" means "every". so that "* 3" would mean "every minute at hour 3" * "*/2" means "each 2" ### installation of dcron ~~~ su root # dcron is one of the simpler implementations pacman -S dcron systemctl enable crond # remove the included preset jobs and directories - /etc/cron.daily and the like crontab -d && rmdir /etc/cron* mkdir /etc/cron.d # create rules in cron job files nano /etc/cron.d/myscript systemctl start crond ~~~ crond sends the standard output from jobs per mail. you may not want this, so edit "/etc/conf.d/crond" and add "-m off" to the arguments. "systemctl status crond" shows log and error information