linux ยท reference

Linux HOW-TOs


Get .ini file value

sed -nr "/^\[protocol.mysql\]/ { :l /^password[ ]*=/ { s/.*=[ ]*//; p; q;}; n; b l;}" /etc/somefile

where protocol.mysql is the section and password is the variable name.

Fancy PS1 prompt

export PS1='[\u@\[\033[41;1m\]\h\[\033[0m\] \W(openstack_$OS_TENANT_NAME)]\$ '

dont forget to add \[ \] around control codes or cursor position will be wrong


Youtube-DL shortcuts


youtube-dl -o "%(playlist_title)s/%(autonumber)02d - %(title)s.%(ext)s"

Dump all formats

youtube-dl -F URL

Download one or many formats (mix)

youtube-dl -f 251 URL   # Audio only
youtube-dl -f 278+251 URL   # Audio + video
youtube-dl -f 'bestvideo[ext=mp4]+bestaudio[ext=m4a]/best[ext=mp4]/best' URL
youtube-dl -f 'bestvideo[height<=480]+bestaudio[ext=m4a]/best[height<=480]' URL


Rename mate-screensaver-commandto .orig and symlink xscreensaver-command to mate-screensaver-command. Rename mate-screensaver to .orig. Edit exec section in /etc/xdg/autostart/mate-screensaver.desktop and change it to

Exec=/usr/bin/env http_proxy= xscreensaver -no-splash

Least annoying screensavers: grav, bsod (-no-nvidia), starwars, glsnake, apple2, glmatrix, substrate, cubicgrid, loop, phosphor.


Windows fonts

Copy *.ttf from windows installation into /usr/share/fonts/truetype/win10 then run fc-cache -f on that directory

Change domain password

Pick Domain controller from the list using

dig -t srv _ldap._tcp.dc._msdcs.[domain_name]


smbpasswd -U DOMAIN/username -r ip_of_domain_controller
comments powered by Disqus