Personal web page of Roman Pavelka, an software engineer

Bash tricks

In all php files look for string “We are currently” and print filename and line number for every match:

find . -iname "*php" -exec grep -Hn "We are currently" "{}" \;

Inkscape can convert files from bash!

inkscape -z -D --file=input.svg --export-pdf=output.pdf

Very useful to know:

Nice aliases

export LANG=cs_CZ.utf8

# user@hostname path $: 
PS1='\[\e[00;32m\]\u@\h\[\e[m\] \[\e[1;34m\]\w \$ \[\e[m\]\[\e[00m\]'

# root@hostname path $: 
PS1='\[\e[1;31m\]\u@\h\[\e[m\] \[\e[1;34m\]\w\[\e[m\] \[\e[1;31m\]\$ \[\e[m\]\[\e[0;00m\]'

alias a='nano ~/.bash_aliases && . ~/.bash_aliases'

alias ..='cd ..'
alias l='ls -a --color'
alias ll='ls -alh --color'

alias sdr='screen -dr'
alias sr='screen -r'

alias work='cd ~/work'

# love this
alias matplotlib='python3 -i -c "from datetime import datetime as dt;from datetime import timedelta as td;import matplotlib.pyplot as plt;plt.ion()"'

# sometimes useful for webservers, modify according to your needs
alias wgr='chmod -R g+r /var/www; chgrp -R www-data /var/www'
alias www='cd /var/www'

# network troubleshooting
alias pingg='ping'
alias pinggg='ping'

# gcc include stuff
alias printIncludePath='echo | gcc -E -Wp,-v - 2>&1 | grep "^ "'

# docker (docker ps and docker container ls are same commands)
alias listRunningContainers='docker container ls -s'
alias listAllContainers='docker container ls -as'
alias killAllContainers='docker kill $(docker ps -q)'
alias removeAllContainers='docker rm $(docker ps -a -q)'
Roman Pavelka, 2020