Skip to content

Instantly share code, notes, and snippets.

Created September 12, 2014 14:37
Show Gist options
  • Select an option

  • Save anonymous/a9055e30f97bd19645c2 to your computer and use it in GitHub Desktop.

Select an option

Save anonymous/a9055e30f97bd19645c2 to your computer and use it in GitHub Desktop.

Revisions

  1. @invalid-email-address Anonymous created this gist Sep 12, 2014.
    59 changes: 59 additions & 0 deletions .bash_aliases
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,59 @@

    ## Modified commands
    alias diff='colordiff' # requires colordiff package
    alias grep='grep --color=auto'
    alias more='less'
    alias df='df -h'
    alias du='du -c -h'
    alias mkdir='mkdir -p -v'
    alias nano='nano -w'
    alias ping='ping -c 5'
    alias dmesg='dmesg -HL'

    ## New commands
    alias da='date "+%A, %B %d, %Y [%T]"'
    alias du1='du --max-depth=1'
    alias hist='history | grep' # requires an argument
    alias openports='ss --all --numeric --processes --ipv4 --ipv6'
    alias pgg='ps -Af | grep' # requires an argument
    alias ..='cd ..'

    # Privileged access
    if (( UID != 0 )); then
    alias sudo='sudo '
    alias scat='sudo cat'
    alias svim='sudoedit'
    alias root='sudo -i'
    alias reboot='sudo systemctl reboot'
    alias poweroff='sudo systemctl poweroff'
    alias update='sudo pacman -Su'
    alias netctl='sudo netctl'
    fi

    ## ls
    alias ls='ls -hF --color=auto'
    alias lr='ls -R' # recursive ls
    alias ll='ls -l'
    alias la='ll -A'
    alias lx='ll -BX' # sort by extension
    alias lz='ll -rS' # sort by size
    alias lt='ll -rt' # sort by date
    alias lm='la | more'

    ## Safety features
    alias cp='cp -i'
    alias mv='mv -i'
    alias rm='rm -I' # 'rm -i' prompts for every file
    # safer alternative w/ timeout, not stored in history
    alias rm=' timeout 3 rm -Iv --one-file-system'
    alias ln='ln -i'
    alias chown='chown --preserve-root'
    alias chmod='chmod --preserve-root'
    alias chgrp='chgrp --preserve-root'
    alias cls=' echo -ne "\033c"' # clear screen for real (it does not work in Terminology)

    ## Make Bash error tolerant
    alias :q=' exit'
    alias :Q=' exit'
    alias :x=' exit'
    alias cd..='cd ..'