Skip to content
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
136 lines (110 sloc) 4.35 KB
# ~/.bashrc
# Source:
# If not running interactively, don't do anything.
case $- in
*i*) ;;
*) return;;
# == Prompt ==
# colour codes
# Set a two-line prompt. If accessing via ssh include 'ssh-session' message.
if [[ -n "$SSH_CLIENT" ]]; then
PS1="${MAGENTA}\\u ${WHITE}at ${GREEN}\\h${YELLOW}${ssh_message} ${WHITE}in ${BLUE}\\w \\n$WHITE\$${RESET} "
# == Functions ==
# backup and timestamp files
bak() { for f in "$@"; do cp "$f" "$f.$(date +%FT%H%M%S).bak"; done; }
# change directories and list contents
c() { cd "$@" && ls -aFlhNv --color=always; }
# top 10 most used commands
mostUsedCommands() { history | awk '{print $3}' | sort | uniq -c | sort -rn | head; }
# list files by size from smallest to largest in a directory
mostUsedDiskSpaceByFile() { find "$1" -type f -exec wc -c {} \; | sort -n; }
# replace spaces and non-ascii characters in a filename with underscore
mtg() { for f in "$@"; do mv "$f" "${f//[^a-zA-Z0-9\.\-]/_}"; done; }
# == Aliases ==
alias aaa="generatePkgList -d ~/code/debian && sudo apt update && apt list --upgradable && sudo apt full-upgrade && sudo apt autoremove"
alias arst="setxkbmap us && ~/bin/keyboardconf"
alias asdf="setxkbmap us -variant colemak && ~/bin/keyboardconf"
alias bye="sudo systemctl poweroff"
alias dff="df -hT --total"
alias down="c ~/Downloads"
alias dpkgg="dpkg -l | grep -i"
alias e="nvim"
alias earthview="streamlink best &"
alias gpush="git push -u origin master"
alias gsave="git commit -m 'save'"
alias gs="git status"
alias l="ls -aFlhNv --color=always"
alias lsblkk="lsblk -o NAME,SIZE,FSTYPE,MOUNTPOINT,UUID"
alias mkdirr="mkdir -pv"
alias myip="ip -f inet address | grep inet | grep -v 'lo$' | cut -d ' ' -f 6,13 && curl && echo ' external ip'"
alias p="less -R"
alias psg="ps aux | grep -v grep | grep -i -e VSZ -e"
alias reboot="sudo systemctl reboot"
alias tmuxd="tmux -f ~/.tmux.default attach"
alias virtualBoxFusion="VirtualBox -style Fusion %U"
alias x="exit"
alias yta="youtube-dl --extract-audio --audio-format mp3 --audio-quality 0 --restrict-filenames"
alias zzz="sync && sudo systemctl suspend"
if [[ -f ~/.bash_aliases ]]; then
# shellcheck source=/dev/null
. ~/.bash_aliases
# == History ==
# Unlimited history.
# Change the history file location because certain bash sessions
# truncate ~/.bash_history upon close.
# Default is to write history at the end of each session, overwriting
# the existing file with an updated version. If logged in with multiple
# sessions, only the last session to exit will have its history saved.
# Require prompt write to history after every command and append to the
# history file, don't overwrite it.
shopt -s histappend
# Now you can see the commands from all shells in near real-time
# in ~/.bash_unlimited history. Starting a new shell displays the
# combined history from all terminals.
# Add a timestamp per entry. Useful for context when viewing logfiles.
# Save all lines of a multiple-line command in the same history entry.
shopt -s cmdhist
# Re-edit a history substitution line if it failed.
shopt -s histreedit
# Edit a recalled history line before executing.
shopt -s histverify
# Do not put lines starting with space in the history.
# Toggle history off/on for a current shell.
alias stophistory="set +o history"
alias starthistory="set -o history"
# Helpful!
# == Misc ==
# When resizing a terminal emulator, check the window size after each
# command and, if necessary, update the values of LINES and COLUMNS.
shopt -s checkwinsize
# Use `keychain` for ssh-agent management
if [[ -x /usr/bin/keychain ]]; then
keychain ~/.ssh/id_ed25519
# shellcheck source=/dev/null
. "${HOME}/.keychain/${HOSTNAME}-sh"
# Style QT apps with the chosen GTK theme.
# Disable XON/XOFF flow control. Enables use of C-S in other commands.
# Examples: forward search in history; disable screen freeze in vim.
stty -ixon
You can’t perform that action at this time.