Last active
May 20, 2021 09:27
-
-
Save amoilanen/0709d0c86fff88969981248fdaba4ed8 to your computer and use it in GitHub Desktop.
Useful Bash utilities which might be added, for example, to .bashrc
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
alias view-staged-diff="git diff --staged > ~/temp/changes.diff && gedit ~/temp/changes.diff &" | |
alias view-diff="git diff > ~/temp/changes.diff && gedit ~/temp/changes.diff &" | |
free_port() { | |
kill -9 $(lsof -t -i:$1) | |
} | |
terminate() { | |
pids_to_kill=$(ps aux|grep $1|awk '{print $2}') | |
[[ ! -z $pids_to_kill ]] && kill -9 $pids_to_kill | |
} | |
add_github_key() { | |
eval $(ssh-agent) | |
sleep 0.5 | |
ssh-add ~/.ssh/github | |
} | |
restart_kde_plasma() { | |
sudo killall plasmashell | |
sleep 1 | |
kstart plasmashell | |
} | |
find_large_dirs() { | |
du -h | grep '^[0-9]\.*[0-9]*G' | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment