Skip to content

Instantly share code, notes, and snippets.

@xiris
Last active September 18, 2020 14:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save xiris/17a7d2f5dce6a827036b to your computer and use it in GitHub Desktop.
Save xiris/17a7d2f5dce6a827036b to your computer and use it in GitHub Desktop.
# File: ~/bash_aliases
# Author: Oliver Michels <oliver.michels@gmx.net>
# Desc: Definition of some useful aliases for the bash
# Some common shortcuts for file-/directory commands
alias ls='ls --color=auto'
alias la='ls -a'
alias ll='ls -l'
alias lla='ls -la'
alias l='ls'
alias grep='grep --color=auto'
# Some common shortcuts for tools
alias j='jobs'
alias v='vim'
alias gvim='gvim -X -geom 100x55'
alias g='gvim'
alias ric='ri -f ansi'
# Aliases for git
alias git='git --no-pager'
alias gs='git status'
alias gb='git branch -a --color'
alias gd='git diff --color'
alias gc='git commit'
alias ga='git add'
alias gl='git log --pretty=oneline'
alias gps='git push'
alias gpl='git pull'
alias gco='git checkout'
alias grm='git rm'
alias gmv='git mv'
# Aliases for common chmods
alias 000='chmod 000'
alias 644='chmod 644'
alias 755='chmod 755'
# Aliases for software managment
alias pacman='sudo pacman'
alias update='sudo pacman -Syu'
# Outdated aliases for Debian-based systems -> to be removed someday
#alias agu='sudo apt-get update'
#alias agg='sudo apt-get upgrade'
#alias agi='sudo apt-get install'
#alias acs='apt-cache search'
# Execute the last command as root
alias lr='sudo $(history | tail -n 2 | head -n 1 | sed -e "s/^[ ]*[0-9]*[ ]*//g")'
# Search for a process containing a given name
function pps() {
ps aux | grep "$@" | grep -v 'grep';
}
# File: ~/bashrc_arch
# Author: Oliver Michels <oliver.michels@gmx.net>
# Desc: Configuration of the bash for non-login shells on Arch Linux
#.bashrc
if [[ $- != *i* ]] ; then
# Shell is non-interactive. Be done now!
return
fi
# Bash completion
if [ -f /etc/bash_completion ]; then
. /etc/bash_completion
fi
# Colors
if [ -f ~/.dir_colors ]; then
eval `dircolors ~/.dir_colors`
fi
# Alias definitions.
# You may want to put all your additions into a separate file like
# ~/.bash_aliases, instead of adding them here directly.
# See /usr/share/doc/bash-doc/examples in the bash-doc package.
if [ -f ~/.bash_aliases ]; then
. ~/.bash_aliases
fi
# Shell variables
export OOO_FORCE_DESKTOP=gnome soffice
export BROWSER='chromium'
export PAGER=less
export EDITOR=vim
export PATH=$PATH:$HOME/bin:/usr/local/bin
export LESS='-R'
export HISTCONTROL=ignoredups
export HISTSIZE=5000
export HISTFILESIZE=1000
export HISTIGNORE="&:ls:ll:la:l.:pwd:exit:clear"
LESSOPEN="|lesspipe.sh %s"; export LESSOPEN
stty -ixon # disable XON/XOFF flow control (^s/^q)
complete -cf sudo # Tab complete for sudo
# shopt options
shopt -s cdspell # This will correct minor spelling errors in a cd command.
shopt -s histappend # Append to history rather than overwrite
shopt -s checkwinsize # Check window after each command
shopt -s dotglob # files beginning with . to be returned in the results of path-name expansion.
# set options
set -o noclobber # prevent overwriting files with cat
set -o ignoreeof # stops ctrl+d from logging me out
# Prompt
PS1='\[\e[0;32m\]\u\[\e[m\] \[\e[1;34m\]\w\[\e[m\] \[\e[1;31m\]$(__git_ps1 "(%s)")\[\e[m\] \[\e[1;32m\]\$ \[\e[m\]\[\e[1;37m\] '
# X Terminal titles
case "$TERM" in
xterm*|rxvt*)
PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME}: ${PWD}\007"'
;;
*)
;;
esac
# Print some nice fortune text
fortune
echo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment