Created
September 16, 2019 20:38
-
-
Save zrkb/93a5fdc303f96ff0d3e889159cfbe770 to your computer and use it in GitHub Desktop.
.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
| # .bashrc | |
| # User specific aliases and functions | |
| alias rm='rm -i' | |
| alias cp='cp -i' | |
| alias mv='mv -i' | |
| alias ls='ls -lh' | |
| alias vi='vim' | |
| # Source global definitions | |
| if [ -f /etc/bashrc ]; then | |
| . /etc/bashrc | |
| fi | |
| # User specific aliases and functions | |
| # Prompt | |
| BGREEN='\[\033[1;32m\]' | |
| GREEN='\[\033[0;32m\]' | |
| BRED='\[\033[1;31m\]' | |
| RED='\[\033[0;31m\]' | |
| BBLUE='\[\033[0;34m\]' | |
| BLUE='\[\033[0;36m\]' | |
| NORMAL='\[\033[00m\]' | |
| export PS1="\n[\t] \[\e[1;36m\]\u@\[\e[32;1m\]\H:${BLUE}\w\n\$ \[\e[0m\]" | |
| # Colorize the ls output | |
| alias egrep='egrep --color=auto' | |
| alias fgrep='fgrep --color=auto' | |
| alias grep='grep --color=auto' | |
| alias ls='ls --color=auto -lh' | |
| # Use a long listing format | |
| alias ll='ls -la' | |
| # Show hidden files | |
| # A quick way to get out of current directory | |
| alias ..='cd ..' | |
| alias .3='cd ../../../' | |
| alias .4='cd ../../../../' | |
| alias .5='cd ../../../../../' | |
| # Colorize the grep command output for ease | |
| # of use (good for log files) | |
| alias grep='grep --color=auto' | |
| alias egrep='egrep --color=auto' | |
| alias fgrep='fgrep --color=auto' | |
| # install colordiff package first :) | |
| alias diff='colordiff' | |
| # Show open ports | |
| alias ports='netstat -tulanp' | |
| # Security | |
| # Do not delete / or prompt if deleting more than 3 files at a time | |
| alias rm='rm -I --preserve-root' | |
| # Confirmation | |
| alias mv='mv -i' | |
| alias cp='cp -i' | |
| alias ln='ln -i' | |
| # Parenting changing perms on / # | |
| alias chown='chown --preserve-root' | |
| alias chmod='chmod --preserve-root' | |
| alias chgrp='chgrp --preserve-root' | |
| # Show text file without comment (#) lines (Nice alias for /etc files which have tons of comments like /etc/squid.conf) | |
| # Usage: nocomment /etc/squid.conf | |
| alias nocomment="grep -Ev '''^(#|$)'''" | |
| #progress bar on file copy. Useful evenlocal. | |
| alias cpr="rsync --progress -ravz" | |
| # Illustrate long timeout in one pass | |
| alias ping="time ping" | |
| # | |
| alias bashrc="vim ~/.bashrc && source ~/.bashrc" | |
| ## If you search the command history a lot | |
| alias h='history' | |
| alias hg='history|grep' | |
| # List of processes w/ your search | |
| alias psg="ps aux | grep -v grep | grep -i -e VSZ -e" | |
| # User Custom Functions | |
| # Create directory and the inmediately move into it | |
| mcd () { | |
| mkdir -p $1 | |
| cd $1 | |
| } | |
| # Most used commands | |
| hmu () { | |
| history | awk '{CMD[$2]++;count++;}END { for (a in CMD)print CMD[a] " " CMD[a]/count*100 "% " a;}' | grep -v "./" | column -c3 -s " " -t | sort -nr | nl | head -n10 | |
| } | |
| up () { | |
| local d="" | |
| limit=$1 | |
| for ((i=1 ; i <= limit ; i++)) | |
| do | |
| d=$d/.. | |
| done | |
| d=$(echo $d | sed 's/^\///') | |
| if [ -z "$d" ]; then | |
| d=.. | |
| fi | |
| cd $d | |
| } | |
| export LESS_TERMCAP_mb=$(printf '\e[01;31m') # enter blinking mode – red | |
| export LESS_TERMCAP_md=$(printf '\e[01;35m') # enter double-bright mode – bold, magenta | |
| export LESS_TERMCAP_me=$(printf '\e[0m') # turn off all appearance modes (mb, md, so, us) | |
| export LESS_TERMCAP_se=$(printf '\e[0m') # leave standout mode | |
| export LESS_TERMCAP_so=$(printf '\e[01;33m') # enter standout mode – yellow | |
| export LESS_TERMCAP_ue=$(printf '\e[0m') # leave underline mode | |
| export LESS_TERMCAP_us=$(printf '\e[04;36m') # enter underline mode – cyan | |
| # PATH and Common Settings | |
| export PATH=/root/.composer/vendor/bin:$PATH | |
| # PHP Artisan (Laravel) | |
| alias artisan='php artisan' | |
| # Shortcuts to most used directories | |
| ww () { | |
| cd /var/www/html/$1 | |
| } | |
| vhosts () { | |
| cd /etc/httpd/conf.d/$1 | |
| } | |
| chapache() { | |
| command sudo chown -R root $1 && sudo chgrp -R apache $1 && sudo chmod -R g+w $1 | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment