Linux Configuration
RPM files
extract example
cd ~/Downloads
mkdir mariadb
mkdir mariadb/10.2
cd mariadb/10.2
rpm2cpio ../../MariaDB-devel-10.2.8-1.fc26.x86_64.rpm | cpio -idmv
GNU parallel
USB
- display list of devices
 lsusb
clean dnf database
@@commandline packages can be removed using dnf autoremove command
- list packages
 sudo dnf list autoremove- remove listed packages
 sudo dnf autoremove- if script is preventing package from removal
 sudo dnf --setopt=tsflags=noscripts remove gnome-tweak-tool
Mendeley Desktop
Dependencies
qt5-qtwebengine
Installation
- download latest version from releases
 - run 
sudo rpm -ivh mendeleydesktop-*.rpm 
File manager
nemo
add shortcut to open terminal
- search for “terminal” in 
~/.gnome2/accels/nemo - insert e.g. 
F4as shortcut 
Fonts
Font Manager
GUI to import and manage user fonts
- install
 dnf install -y font-manager
flatpak
- list installed runtimes and applications do
 flatpak list
org.gnome.Games/x86_64/master           system,current
org.gnome.Games.Locale/x86_64/master    system,runtime
org.gnome.Platform.Locale/x86_64/3.20   system,runtime
org.gnome.Platform.Locale/x86_64/master system,runtime
org.gnome.Platform/x86_64/3.20          system,runtime
org.gnome.Platform/x86_64/master        system,runtime
- uninstall a runtime or application named 
name flatpak uninstall name
$ flatpak uninstall Games
$ flatpak uninstall org.gnome.Platform//3.20
$ flatpak uninstall org.gnome.Platform//master
Screencast
Vokoscreen
OpenShot
- install
 $ mkdir ~/AppImage
$ cd ~/AppImage
$ chmod +x OpenShot-v2.2.0-x86_64.AppImage
$ ./OpenShot-v2.2.0-x86_64.AppImage
Security
- disable Bash history
 $ set +o historyand$ set -o historyto enable again
DNS
- check CNAME using 
dig $ dig bowerth.github.io +nocmd +nostats +noquestion
System information
Fan speed
- use 
sensorscommand ofLm_sensorsto monitor $ sensors
Battery status
- display location of 
upower $ upower -e- check status
 $ upower -i /org/freedesktop/UPower/devices/battery_BAT0
energy: 46.5964 Wh  
energy-full: 52.2423 Wh  
energy-rate: 16.5406 W  
time to full: 20.5 minutes  
percentage: 89%  
- using 
acpi $ acpi -V
Battery 0: design capacity 6930 mAh, last full capacity 6838 mAh = 98%
root
- set root password
 - log in as root 
$ sudo -s
set password$ passwd 
Nix The Purely Functional Package Manager
- download and run install script
 $ curl https://nixos.org/nix/install | sh- reload 
~/.bash_profile $ source ~/.bash_profile
aMule
aMule CMD
modify parameters in ~/.aMule/amule.conf
[ExternalConnect]
AcceptExternalConnections=1
ECPassword=
- create password
 $ echo -n yourpasswordhere | md5sum | cut -d ' ' -f 1- start aMule and connect using 
amulecmd $ amulecmd(type password)
C* (cmus)
install dependencies
libmad-devellibcue | libcue-devel | OKlibpulse | pulseaudio-libs-devel | OKpulseaudio | pulseaudio-devel | OKsamplerate | libsamplerate-devel | OKlibavformat, libavcodec | ffmpeg-devel | OKopusfile | opusfile-devel | OK
additional output plugins:
alsajacklibroar
- start
 /home/xps13/cmus/bin/cmus- exit
 :quit <Enter>- list installed output plugins
 $ cmus --plugins- set output device (“no output plugin detected”)
 :set output_plugin=pulse
add files
- open file browser
 5- add file/folder
 a- open library view
 2
create desktop entry
create ~/.local/share/applications/cmus.desktop with contents:
[Desktop Entry]
Encoding=UTF-8
Version=1.0
Type=Application
Display=true
Exec=cmus-remote -f %f
Terminal=false
Name=cmus-remote
Comment=Music player cmus-remote control
in order to add to gnome favorites, the .desktop file must be named exactly the same as the started application
Dropbox
ask.fedoraproject.org: dropbox failed synchronize cache for repo
- modify repo file
 /etc/yum.repos.d/dropbox.repofrombaseurl=http://linux.dropbox.com/fedora/$releasever/tobaseurl=http://linux.dropbox.com/fedora/22/
Docker Cloud Images
Programs
uchardet
- identify the encoding of a file
 $ uchardet [textfile]
Feednix
Feednix is s simple ncurses-based console client for Feedly
Fedora 23
- install dependencies
 $ sudo dnf install -y dh-autoreconf ncurses-devel jsoncpp-devel libcurl-devel- configure, make, install
 $ ./configure && make && sudo make install- copy configuration file
 $ cp config.json ~/.config/feednix/- create symbolic link in 
/etc/xdgfolder $ sudo ln -s ~/.config/feednix /etc/xdg/feednix- enter developer token
 ...:feedlydev- start program
 $ /usr/bin/feednixor simply$ feednix
commands
- add new feed
 a
Google Chrome
Mozilla Firefox
Add-ons
Thunderbird
- install thunderbird
 sudo dnf install thunderbird
Add-ons
Composition: plain text and HTML
- activate default message composition in HTML (where defaults can be specified, e.g. using themes)
 Edit > Preferences > Account Settings > Composition & Addressing > "Compose messages in HTML format"- force to send messages as plain text
 Menu > Preferences > Preferences > Composition > Send Options > "Convert the messages to plain text"- display of plain text messages
 - `Edit > Preferences > Display > Fonts & Colors > Colors… > [select colors] > “override the colors…” [always]
 
userChrome.css
- edit 
userChrome.cssin profile folder (createchromefolder if doesn’t exist) ~/.thunderbird/[userprofile].default/chrome/userChrome.css
ALSA
- wiki.archlinux.org: ALSA
 - fedoraproject.org: wiki: how to debug sound problems
 - manpages.ubuntu.com: amixer
 
- create report with detailed information about sound hardware
 $ alsa-info.sh --no-upload- use GUI
 $ alsamixer -c 1- get parameter of binary controls
 $ amixer -c 0 get 'Headphone Jack'
Skype
- ask.fedoraproject.org: sticky-how-do-i-install-skype-on-fedora
 - install dependencies 
sudo dnf -y install libXv.i686 libXScrnSaver.i686 qt.i686 qt-x11.i686 pulseaudio-libs.i686 pulseaudio-libs-glib2.i686 alsa-plugins-pulseaudio.i686 - download Fedora RPM from skype.com/download-skype
 - 
    
navigate to download folder and execute
sudo dnf install skype-*.rpm - GNOME integration github.com: chrisss404: gnome-shell-ext-SkypeNotification
 
Encryption
Passwords
- install keepassx on Fedora 22
 sudo dnf install keepassx
GPG
- list keys
 gpg --list-keys- to export a public key into file 
public.key gpg --export -a "User Name" > public.key- delete a public key (from your public key ring)
 gpg --delete-key "User Name"- to import a public key
 gpg --import [public key file]- to export a private key
 gpg --export-secret-key -a "User Name" > private.key- to import a private key
 gpg --allow-secret-key-import --import private.key- to encrypt a single file, use command gpg as follows
 gpg -c filename
Ubuntu
Flash player
- download .deb file from ppa launchpad
 - remove existing flash installations (
flashplayer-installer,flash-plugin) - close browser
 - install using 
sudo dpkg -i [package name] 
Fedora Server
CentOS 7
- adjust screen brightness
 $ xrandr --output LVDS1 --brightness 0.7e.g. for 70%
Fedora
Differences to Redhat and CentOS
User management
- add an existing user to existing group
 $ sudo usermod -a -G hadoop xps13
Install Workstation Live Image
install or update Adobe Flash Player
Fedora 21
$ yum install flash-plugin
Fedora 22
- download .rpm version (PPAPI) from https://get.adobe.com/flashplayer/
 $ sudo dnf remove flash-plugin$ sudo rpm -i ~/Downloads/flash-plugin-[version]-release.x86_64.rpm
screen brightness Toshiba
jamielinux: adjust screen brightness forums.fedoraforum.org: Fix for Toshiba laptops with no control of brightness after suspend
add acpi_backlight=vendor in the kernel command line
- append to edit grub 
GRUB_CMDLINE_LINUX="rd.md=0 [...] rhgb quiet acpi_backlight=vendor" sudo nano /etc/default/grub- backup 
grub.cfg sudo cp /boot/grub2/grub.cfg /boot/grub2/grub.cfg.backup- update 
grub.cfg sudo grub2-mkconfig -o /boot/grub2/grub.cf- check contents of new 
grub.cfgin editor without root permission sudo cat /boot/grub2/grub.cfg > ~/Downloads/grub.cfg
place the quoted 99toshiba script (below) in /etc/pm/sleep.d/ where the content of the script for /etc/pm/sleep.d/99toshiba is:
#!/usr/bin/env sh
# /etc/pm/sleep.d/99toshiba
if [ $1 == suspend ]
then
cat /sys/class/backlight/intel_backlight/brightness > /var/run/brightness
elif [ $1 == resume ]
then
echo 3 > /sys/class/backlight/toshiba/brightness
cat /var/run/brightness > /sys/class/backlight/intel_backlight/brightness
fi
- Also remember to make it runnable to root
 chmod 744 /etc/pm/sleep.d/99toshiba
update Fedora 25 to 26 using DNF system upgrade
- needed to install 
gnome-tweak-toolfrom GNOME/gnome-tweak-tool 
sudo dnf system-upgrade download -y --releasever=26 --allowerasing
dnf system-upgrade reboot
dnf clean packages
update Fedora 22 to 23 using DNF system upgrade
- update your system using the standard updater for your desktop or pkcon or dnf
 $ sudo dnf update --refresh- install Package-x-generic-16.pngdnf-plugin-system-upgrade package:
 $ sudo dnf install dnf-plugin-system-upgrade- download the updated packages
 $ sudo dnf system-upgrade download --releasever=23- trigger the upgrade process
 $ sudo dnf system-upgrade reboot- install unsigned packages
 - add 
--nogpgcheck 
update Fedora 21 to 22 using FedUp
Using a network source is the easiest method of upgrading and will pull in updates while upgrading - eliminating the potential issue if your current system has a newer kernel version than the Fedora release to which you are upgrading.
- Start the upgrade prep by executing following command
 sudo yum update fedup fedora-release- If you are upgrading from Fedora 20 to Fedora 21, run the following command
 sudo fedup --network 21 --product=[workstation | server| cloud | nonproduct]- If you are upgrading from Fedora 21 to Fedora 22 or above, run the following command
 sudo fedup --network 22
Once the preparations have completed, check the /var/log/fedup.log file if any errors show up in the output from fedup
Source: FedUp
Language Support
- simplified chinese (non-Unicode)
 sudo dnf groupinstall simplifided-chinese-support
Wayland
Wayland is intended as a simpler replacement for X, easier to develop and maintain.
GNOME Shell Extensions
i3 A window tile manager
- kill GNOME desktop
 $ xkilland click GNOME desktop
GNOME
- log out via the terminal
 gnome-session-quit
- GNOME Tweak Tool: install via package manager
 - makeuseof.com: Make Gnome Shell Usable With These 12 Extensions
 
Terminal
CSS
Create ~/.config/gtk-3.0/gtk.css with the following content and restart the shell.
/* .header-bar.default-decoration { */
/*     padding-top: 3px; */
/*     padding-bottom: 3px; */
/*     border: none; */
/*     background-image: linear-gradient(to bottom, */
/*                                       shade(@theme_bg_color, 1.05), */
/*                                       shade(@theme_bg_color, 0.99)); */
/*     box-shadow: inset 0 1px shade(@theme_bg_color, 1.4); */
/* } */
/* .header-bar.default-decoration .button.titlebutton { */
/*     padding-top: 2px; */
/*     padding-bottom: 2px; */
/* } */
# small title bar
.header-bar.default-decoration {
    padding-top: 3px;
    padding-bottom: 3px;
}
.header-bar.default-decoration .button.titlebutton {
    padding-top: 2px;
    padding-bottom: 2px;
}
GNU
Screen
Screen is a full-screen window manager that multiplexes a physical terminal between several processes, typically interactive shells.
- open help
 $ C-a ?
Disk usage
- with gui
 $ sudo baobab- list directories by size
 $ sudo du /|sort -gr|morefor root folder
$ du .|sort -gr|morefor current folder- list files by size
 $ find . -type f -exec du --human {} + | sort --human --reverse | head- list files recursively by partial string
 $ find -iname "*hsfclmap*"- check for incomplete files
 $ find -iname "*.tmp"
Cache
- start as root
 sudo baobab- clean 
/var/cache(large PackageKit folder) sudo dnf clean all- using PackageKit console client
 sudo pkcon refresh force -c -1- large 
/var/cache/PackageKit: modify/etc/PackageKit/PackageKit.conf # Keep the packages after they have been downloaded
#KeepCache=false
runpkcon refresh force -c -1- delete PackageKit metadata manually
 sudo rm -r /var/cache/PackageKit/25/*- old releases
 yum clean all --releasever=19- log files
 rm -r /var/log/journal/*
Environment variables
/etcdirectory- global settings (used for 
sudo), otherwise overwritten by files in home directory /etc/environment- define 
PATHvariable, e.g. texlive path orhttp_proxyforcurl /etc/profile- global environment
 /etc/bashrc- global functions and aliases
 
shell commands, bash files
- terminate a process
 killall -9 firefox
find
- list all files recursively with specific extension
 $ find . -type f -name "*.epub"
ls
- list all files and directories in path
 ls $HOME
find
- find files in path
 find $HOME/. -maxdepth 1 -type f
executable script files
- make bash file executable
 sudo chmod +x file
string operations
sed
- not working Grymoire: 
sedIntroduction - http://web.eecs.utk.edu: Sed/Ed lecture
 - nixCraft: Linux/Unix: Shell Remove Empty Lines
 
- global replace
 sed -e 's:\\(:(:g' $path/${file}_temp.md > $path/${file}_temp2.md- complex expression to replace multiple blank lines with two blank lines, see stackexchange: How to remove multiple blank lines from a file?
 sed -r ':a; /^\s*$/ {N;ba}; s/( *\n *){2,}/\n\n/'- combine with 
printf printf "line one\\nline two\\n" | sed -e 's/.*/( & )/'
tr
- remove newline
 tr '\n' ' ' < input_filename- remove newline
 tr -d '\n' < file
startup files
~/home directoryls -ashow all files in directory order of execution.bash_profileprivate equivalent of/etc/profile, source from.bashrc.bashrcsources from/etc/bashrc.bash_login.profilemodify environment variables, e.gPATH
- create simple http server
 cd ~/Downloads/scipy-lectures.github.com-master/ \&& python -m SimpleHTTPServer
Example: proxy settings
- in order to use 
yum, the global environment variablehttp_proxyneeds to be defined - this can be achieved with 
sudo su,http_proxy=http://wsg-proxy.oecd.org:80,export http_proxy 
grep
- Limit grep context to N characters on line
 N=10; grep -roP ".{0,$N}time.{0,$N}" TariffLineSdmx.xml- return all files with a specific extension
 ls -al | grep .git- return all occasions with “PATH”
 grep -i "PATH" .*- search for term in subfolder
 grep -i ".jParProperties" R/*- search files in path recursively, only print filename
 grep -rl "gh-training-logo" [path]- remove all files with a specific pattern
 rm sample*.log- change theme for specific window (firefox, thunderbird etc.)
 xprop -f _GTK_THEME_VARIANT 8u -set _GTK_THEME_VARIANT dark
jpdftweak
Can be used to modify bookmarks (i.e. “Outline” in Evince). The format of a bookmark file in csv format is as follows:
1;O;1 Scala Language Basics;32 FitH 758
1;O;2 Basics of Object-Orientation and Software Development;82 FitH 758
1;O;3 Details of Object-Orientation in Scala;112 FitH 758
...
pdftk
- separate into pages
 pdftk document.pdf burst
pdftotext
- convert pdf to text
 pdftotext [file]- search resulting file for RegExp
 grep '^[0-9][ ][A-Z].*' scala-toc.txt- reduze PDF file size
 convert -density 200x200 -quality 60 -compress jpeg input.pdf output.pdf
qpdf
- decrypt
 qpdf --password=[...] --decrypt [sourcefile] [destfile]- combine pages
 qpdf --empty --pages "02_Main.pdf" 1-6 "03_Main.pdf" 1-8 -- "out.pdf"
PDFMtEd
- install dependencies Fedora 23
 $ sudo dnf install -y yad perl-Image-ExifTool qpdf- clone repository
 $ git clone git@github.com:Glutanimate/PDFMtEd.git- edit file (reports error on save and does not recognize existing metadata)
 $ ./pdfmted-editor "/home/xps13/Documents/Mendeley Desktop/Bergeron - 2003 - Essentials of XBRL, Financial Reporting in the 21st Century.pdf"
ToDo
- create ruby module to pick up page source md file, generate pdf and trigger file download with default location and file name
 
Maintenance
- large 
/var/log/journal: modify/etc/systemd/journald.conf - set 
SystemMaxUse=1M
sudo systemctl restart systemd-journald
setSystemMaxUse=200M
sudo systemctl restart systemd-journald