Last active
June 16, 2016 09:08
-
-
Save tsur/52d39a4452d410878864 to your computer and use it in GitHub Desktop.
bash alias ubuntu
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
# “For almost every purpose, aliases are superseded by shell functions.” -- bash man page | |
alias rm-alias="unalias -a" | |
alias ..="cd .." | |
alias ..2="cd ../.." | |
alias ..3="cd ../../.." | |
alias ..4="cd ../../../.." | |
alias ..5="cd ../../../../.." | |
alias cdp="cd /var/projects" | |
# Use it as: pbcopy < myfile | |
alias pbcopy="xsel --clipboard --input" | |
alias pbpaste="xsel --clipboard --output" | |
# bash edit & reload | |
alias .b="source ~/.bashrc" | |
alias bashrc="vim ~/.bashrc && source ~/.bashrc" | |
alias bashp="vim ~/.bash_profile && source ~/.bash_profile" | |
alias ls='ls --color=auto' | |
# ls long output | |
alias ll='ls -lashr --color=auto' | |
# ls hidden | |
alias l.='ls -d .* --color=auto' | |
# List all open ports & connections | |
alias ls-ports="lsof -Pi | grep LISTEN" | |
alias ls-connections='sudo lsof -n -P -i +c 15' | |
# Show all paths in the $PATH environment variable | |
alias ls-paths='echo -e ${PATH//:/\\n}' | |
alias grep='grep --color=auto' | |
# Start a calculator | |
alias calc='bc -l' | |
alias mkdir='mkdir -pv' | |
function mkdircd () { mkdir -p "$@" && eval cd "\"\$$#\""; } | |
alias now='date +"%d-%m-%Y %T"' | |
alias vi=vim | |
# Stop after sending count ECHO_REQUEST packets | |
alias ping='ping -c 5' | |
# network address info | |
alias inet='ifconfig | grep inet' | |
# shortcut for iptables and pass it via sudo | |
alias ipt='sudo /sbin/iptables' | |
# firewall rules | |
alias firewall='sudo /sbin/iptables -L -n -v --line-numbers' | |
alias firewallin='sudo /sbin/iptables -L INPUT -n -v --line-numbers' | |
alias firewallout='sudo /sbin/iptables -L OUTPUT -n -v --line-numbers' | |
alias firewallfw='sudo /sbin/iptables -L FORWARD -n -v --line-numbers' | |
# Update and upgrade command | |
alias update='sudo apt-get update && sudo apt-get upgrade' | |
# Shutdown, reboot | |
alias reboot='sudo /sbin/reboot' | |
alias poweroff='sudo /sbin/poweroff' | |
alias halt='sudo /sbin/halt' | |
alias shutdown='sudo /sbin/shutdown' | |
# Get cpu info | |
alias cpuinfo='lscpu' | |
alias top='htop' | |
alias df='df -H' | |
alias du='du -hd 1' | |
# Show text file without comment (#) lines, usage: nocomment myfile.txt | |
alias nocomment='grep -Ev '\''^(#|$)'\''' | |
alias mountt=’mount |column -t’ | |
alias mongodb="mongod --dbpath ~/mongodb" | |
alias redis="redis-server ~/redis/redis.conf" | |
alias update-chrome='sudo apt-get --only-upgrade install google-chrome-stable' | |
# Replace file extensions recursively, i.e. replaceExt(js,es6) | |
replaceExt () { | |
# If new extension is void/empty | |
if [ -z "$2" ]; then | |
for file in **/*.$1;do mv $file $(echo ${file%*.*});done | |
exit 0; | |
fi | |
for file in **/*.$1;do mv $file $(echo ${file%*.*}.$2);done | |
} | |
export PS1="\d \t @\u:\w$ " |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment