Little useful shell scripts
Here's the --help for each shell script:
These bash_aliases need to be called from ~/.bashrc or similar like this:
They provide the following commands:
df - execute "df -h" du - execute "du -h" bc - allow for calculations with decimal places by default in bc hg - grep shell history hl - page shell history pg - grep processes rgl - rgrep regex | less aps - execute 'ansible-playbook setup.yml' apst- execute 'ansible-playbook setup.yml --tags=' apt-find file - say which Debian package contains "file" needs apt-file
Shortcuts to put firefox or thunderbird to rest. Requires firefox-sleep/wake and thunderbird-sleep/wake
ffs, ffw, ths, thw
g - status gd - diff ga - add gac - add and commit, commit msg is optional gc - commit gca - commit -a gcam - commit -a -m gci - commit --interactive
chmod shortcuts (not available in zsh)
+x file +r file +w file a+x file a+r file a+w file
cdreal file - chdir to wherever the file is located cdwhich file - chdir to wherever the executable is located mcd file - make directory and cd into it
usage: brightness [--show|percent]
set or show panel brightness on intel chips in percent (default ist 60%)
usage: bromium bromium --help
run chromium with an empty temporary profile
usage: catwhich executable
cat executable that is somewhere in $PATH or can be located via "locate"
edit the user's system changelog
usage: copy_args_to_clip arg1 arg2 ...
copy arguments to clipboard (CTRL-V) if no argument is given, then copy stdin to clipboard
usage: copy_args_to_file file_name arg1 arg2 ...
copy arguments to file if no argument is given, then copy stdin to clipboard
usage: copy_file_to_clip [file]
copy file to clipboard (CTRL-V) if no file is given, copies stdin
usage: copy-resolv-conf destination_machine copy-resolv-conf --help
Copies your /etc/resolv.conf over to the destination_machine
copy selection (mouse select) to clipboard (CTRL-V)
usage: copy_stdin_to_file file_name
copy input to file
This script is used to wrap executables in order to analyse how they are called by other scripts, daemons etc. It will log all parameters and the environment of the originally called executable to a log file for inspection. How to use: =========== Let's suppose you want to wrap the executable 'foo': First approach -------------- 1. rename the original executable # cd /where/the/original/lives # mv foo foo.orig 2. copy executable_wrapper where 'foo' was before # cp executable_wrapper /where/the/original/lives/foo Second approach --------------- 1. make sure that the 'executable_wrapper' script will be executed instead of the executable 'foo': # cd /usr/local/bin # ln -s ~/path_to/executable_wrapper foo Note that by convention /usr/local/bin comes first in $PATH on Unix systems 2. make the original executable 'foo' available as 'foo.orig' # cd /usr/local/bin # ln -s /bin/foo foo.orig You can also set the name of the original executable in the variable original_exec_name inside the 'executable_wrapper' script if you need to do so. 3. output will be logged to /tmp/foo.log.XXXXXX, where 'XXXXX' will be some random string. You can also set the log name in the variable 'log_name' inside the 'executable_wrapper' script
usage: exif-del image
remove all meta-tags from exif informations
usage: find_ls_sort find_ls_sort --help
A fusion of find and ls. Very useful for comparing systems.
suspend all firefox (and plugin) processes Note: it's advisable to add an 'alias ffs=firefox-sleep See also: firefox-sleep
wake up all firefox (and plugin) processes Note: it's advisable to add an 'alias ffw=firefox-wake See also: firefox-sleep
run infinite loop that will consume 100% of a CPU core Useful for fan and temperature regulation testing
Will jump to the end of /var/log/kern.log, page it with 'less' and update it when it changes.
usage: mairi _search _parameters
mairi searches your mail and displays results in mutt mairi is a simple wrapper around mairix and mutt and accepts the same parameters as mairix
./modinfo_all : list information on all currently installed kernel modules ./modinfo_all --desc : list only description of each module
usage: mount_encrypted image [mountpoint]
see also umount_encrypted if mountpoint is not provided mounts under /media/image
usage: music-dl URL
download URL from youtube, soundcloud etc. and transform to audio file
usage: mv_ln src_ln dest_dir mv_ln --help
Move the symbolic link src_ln into dest_dir while keeping it relative
suspend all pulseaudio processes See also: paw
wake up all pulseaudio processes See also: pas
usage: psa [pattern]
Show all processes in full detail (ps auxw) excluding kernel processes. If a pattern is given, then the process list is grep'ed with that pattern.
usage: show_csv [file.csv] [separator] show_csv --help
pretty print and page CSV file with 'less'
construct a new ~/.ssh/config from ~/.ssh/config.d
tries to switch off the heat producing Radeon VGA card
suspend all thunderbird processes See also: thunderbird-wake
wake up all thunderbird processes See also: thunderbird-sleep
usage: to_jpg image.png [image.jpg]
transform png image to jpg format
usage: umount_encrypted mountpoint
see also mount_encrypted
usage: versioned_backup filename [.file_extension]
makes a versioned backup of filename. If provided then the version number will be inserted before the .file_extension Example: $ ls foo $ versioned_backup foo $ ls foo foo.0001 $ versioned_backup foo $ ls foo foo.0001 foo.0002 $ touch bar.mp3 $ versioned_backup bar .mp3 $ ls foo foo.0001 foo.0002 bar.mp3 bar.0001.mp3
usage: vimn file:n
edit file and jump to line 'n'
edits executable that is somewhere in $PATH or can be located via "locate"
usage: vimx [params] file
create and edit executable bash script that has a --help command
usage: vimx [params] file
create and edit executable bash script under ~/bin
usage: wake-sleep-log wake-sleep-log --help
searches /var/log/kern.log for power management events and displays a list when the machine went to slee and woke up again
usage: wping [URL]
retrieves website via HTTP in order to see whether the web/internet works. Default site is http://sourcepole.ch