Aliases in linux are placeholders for longer commands to enable you to type faster without remembering the full syntax of a command.Aliases are defined usually in a file called .bash_aliases and included by default on some distributions of linux if not the following command will include them if it's added in .bashrc/.bash_profile
if [ -n "$BASH_VERSION" ]; then # include .bash_aliases if it exists if [ -f "$HOME/.bash_aliases" ]; then . "$HOME/.bash_aliases" fi fi
Alias structure
alias name=value alias name='command' alias name='command arg1 arg2' alias name='/path/to/script' alias name='/path/to/script.pl arg1'
Useful aliases
#initialize a git repo and commit all files # #this should be followed by git remote add origin path/to/remote/repo # alias gini='git init && git add . && git commit -m '\''init'\'''#this alias will push the newly initialized repo to the server # alias gpo='git push -u origin master'#list all files in a folder with a human readable size in KB/MB/GB # alias ll='ls -alh' #automatically create parent directory # #normal mkdr dir1/dir2/dir requires dir1 and dir2 to exist # alias mkdir='mkdir -pv' ## shortcut for iptables and pass it via sudo # alias ipt='sudo /sbin/iptables' # display all rules # alias iptlist='sudo /sbin/iptables -L -n -v --line-numbers' alias iptlistin='sudo /sbin/iptables -L INPUT -n -v --line-numbers' alias iptlistout='sudo /sbin/iptables -L OUTPUT -n -v --line-numbers' alias iptlistfw='sudo /sbin/iptables -L FORWARD -n -v --line-numbers' alias firewall=iptlist # get web server headers # alias header='curl -I' # find out if remote server supports gzip / mod_deflate or not # alias headerc='curl -I --compress' ## pass options to free ## alias meminfo='free -m -l -t' ## get top process eating memory alias psmem='ps auxf | sort -nr -k 4' alias psmem10='ps auxf | sort -nr -k 4 | head -10' ## get top process eating cpu ## alias pscpu='ps auxf | sort -nr -k 3' alias pscpu10='ps auxf | sort -nr -k 3 | head -10' ## Get server cpu info ## alias cpuinfo='lscpu' ## get GPU ram on desktop / laptop## alias gpumeminfo='grep -i --color memory /var/log/Xorg.0.log' ## set some other defaults ## alias df='df -H' alias du='du -ch' alias ducks='du -cks * | sort -rn | head'
Whether you want to just say `Hi` or discuss a project or an idea, drop me a line and I will get back to you as soon as possible.