-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
89fa789
commit 0b6673f
Showing
5 changed files
with
1,183 additions
and
1 deletion.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -52,15 +52,245 @@ mkcd(){ | |
mkdir -p "$1" | ||
cd "$1" | ||
} | ||
## Colorize the ls output ## | ||
alias ls='ls --color=auto' | ||
|
||
## Use a long listing format ## | ||
alias ll="ls --color=auto -la" | ||
|
||
## Show hidden files ## | ||
alias l.='ls -d .* --color=auto' | ||
|
||
alias lsport="sudo lsof -i" | ||
##Update Grub## | ||
alias update-grub="sudo grub-mkconfig -o /boot/grub/grub.cfg" | ||
alias {ed,emacs,nano,v,vi,vim}="vim" | ||
##set editer to nano## | ||
alias {ed,emacs,nano,v,vi,vim}="nano" | ||
##easy exit## | ||
alias :q="exit" | ||
##set yay to trizen (personal prefferance)## | ||
alias {yaourt,yay}="trizen" | ||
##Open magic## | ||
alias open="xdg-open" | ||
|
||
# android related aliases | ||
alias aroot="adb shell su -c" | ||
alias admesg="adb shell su -c dmesg" | ||
alias alog="adb logcat" | ||
|
||
## 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' | ||
|
||
##caculator with math support## | ||
alias bc='bc -l' | ||
|
||
##Generate sha1 digest | ||
alias sha1='openssl sha1' | ||
|
||
##Create parent directories on demand | ||
alias mkdir='mkdir -pv' | ||
|
||
##mount for humans | ||
alias mount='mount |column -t' | ||
|
||
# handy short cuts # | ||
alias h='history' | ||
alias j='jobs -l' | ||
|
||
alias path='echo -e ${PATH//:/\\n}' | ||
alias now='date +"%T"' | ||
alias nowtime=now | ||
alias nowdate='date +"%d-%m-%Y"' | ||
|
||
##open ports## | ||
alias ports='netstat -tulanp' | ||
|
||
#firewall | ||
## 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 | ||
|
||
##debug web server | ||
# get web server headers # | ||
alias header='curl -I' | ||
|
||
# find out if remote server supports gzip / mod_deflate or not # | ||
alias headerc='curl -I --compress' | ||
|
||
# become root # | ||
alias root='sudo -i' | ||
alias su='sudo -i' | ||
|
||
#power | ||
|
||
# reboot / halt / poweroff | ||
alias reboot='sudo /sbin/reboot' | ||
alias poweroff='sudo /sbin/poweroff' | ||
alias halt='sudo /sbin/halt' | ||
alias shutdown='sudo /sbin/shutdown' | ||
|
||
|
||
# Control web servers | ||
# also pass it via sudo so whoever is admin can reload it without calling you # | ||
alias nginxreload='sudo /usr/local/nginx/sbin/nginx -s reload' | ||
alias nginxtest='sudo /usr/local/nginx/sbin/nginx -t' | ||
alias lightyload='sudo /etc/init.d/lighttpd reload' | ||
alias lightytest='sudo /usr/sbin/lighttpd -f /etc/lighttpd/lighttpd.conf -t' | ||
alias httpdreload='sudo /usr/sbin/apachectl -k graceful' | ||
alias httpdtest='sudo /usr/sbin/apachectl -t && /usr/sbin/apachectl -t -D DUMP_VHOSTS' | ||
|
||
|
||
#Alias into our backup stuff | ||
# if cron fails or if you want backup on demand just run these commands # | ||
# again pass it via sudo so whoever is in admin group can start the job # | ||
# Backup scripts # | ||
alias backup='sudo /home/scripts/admin/scripts/backup/wrapper.backup.sh --type local --taget /raid1/backups' | ||
alias nasbackup='sudo /home/scripts/admin/scripts/backup/wrapper.backup.sh --type nas --target nas01' | ||
alias s3backup='sudo /home/scripts/admin/scripts/backup/wrapper.backup.sh --type nas --target nas01 --auth /home/scripts/admin/.authdata/amazon.keys' | ||
alias rsnapshothourly='sudo /home/scripts/admin/scripts/backup/wrapper.rsnapshot.sh --type remote --target nas03 --auth /home/scripts/admin/.authdata/ssh.keys --config /home/scripts/admin/scripts/backup/config/adsl.conf' | ||
alias rsnapshotdaily='sudo /home/scripts/admin/scripts/backup/wrapper.rsnapshot.sh --type remote --target nas03 --auth /home/scripts/admin/.authdata/ssh.keys --config /home/scripts/admin/scripts/backup/config/adsl.conf' | ||
alias rsnapshotweekly='sudo /home/scripts/admin/scripts/backup/wrapper.rsnapshot.sh --type remote --target nas03 --auth /home/scripts/admin/.authdata/ssh.keys --config /home/scripts/admin/scripts/backup/config/adsl.conf' | ||
alias rsnapshotmonthly='sudo /home/scripts/admin/scripts/backup/wrapper.rsnapshot.sh --type remote --target nas03 --auth /home/scripts/admin/.authdata/ssh.keys --config /home/scripts/admin/scripts/backup/config/adsl.conf' | ||
alias amazonbackup=s3backup | ||
|
||
## play video files in a current directory ## | ||
# cd ~/Download/movie-name | ||
# playavi or vlc | ||
alias playavi='mplayer *.avi' | ||
alias vlc='vlc *.avi' | ||
|
||
# play all music files from the current directory # | ||
alias playwave='for i in *.wav; do mplayer "$i"; done' | ||
alias playogg='for i in *.ogg; do mplayer "$i"; done' | ||
alias playmp3='for i in *.mp3; do mplayer "$i"; done' | ||
|
||
# play files from nas devices # | ||
alias nplaywave='for i in /nas/multimedia/wave/*.wav; do mplayer "$i"; done' | ||
alias nplayogg='for i in /nas/multimedia/ogg/*.ogg; do mplayer "$i"; done' | ||
alias nplaymp3='for i in /nas/multimedia/mp3/*.mp3; do mplayer "$i"; done' | ||
|
||
# shuffle mp3/ogg etc by default # | ||
alias music='mplayer --shuffle *' | ||
|
||
|
||
## All of our servers eth1 is connected to the Internets via vlan / router etc ## | ||
alias dnstop='dnstop -l 5 eth1' | ||
alias vnstat='vnstat -i eth1' | ||
alias iftop='iftop -i eth1' | ||
alias tcpdump='tcpdump -i eth1' | ||
alias ethtool='ethtool eth1' | ||
|
||
# work on wlan0 by default # | ||
# Only useful for laptop as all servers are without wireless interface | ||
alias iwconfig='iwconfig wlan0' | ||
|
||
## 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' | ||
|
||
## older system use /proc/cpuinfo ## | ||
##alias cpuinfo='less /proc/cpuinfo' ## | ||
|
||
## get GPU ram on desktop / laptop## | ||
alias gpumeminfo='grep -i --color memory /var/log/Xorg.0.log' | ||
|
||
# Reboot my home Linksys WAG160N / WAG54 / WAG320 / WAG120N Router / Gateway from *nix. | ||
alias rebootlinksys="curl -u 'admin:my-super-password' 'http://192.168.1.2/setup.cgi?todo=reboot'" | ||
|
||
# Reboot tomato based Asus NT16 wireless bridge | ||
alias reboottomato="ssh [email protected] /sbin/reboot" | ||
|
||
## this one saved by butt so many times ## | ||
alias wget='wget -c' | ||
|
||
## this one saved by butt so many times ## | ||
alias ff4='/opt/firefox4/firefox' | ||
alias ff13='/opt/firefox13/firefox' | ||
alias chrome='/opt/google/chrome/chrome' | ||
alias opera='/opt/opera/opera' | ||
|
||
#default ff | ||
alias ff=ff13 | ||
|
||
#my default browser | ||
alias browser=google-chrome-stable | ||
|
||
## set some other defaults ## | ||
alias df='df -H' | ||
alias du='du -ch' | ||
|
||
# top is atop, just like vi is vim | ||
alias top='atop' | ||
|
||
## nfsrestart - must be root ## | ||
## refresh nfs mount / cache etc for Apache ## | ||
alias nfsrestart='sync && sleep 2 && /etc/init.d/httpd stop && umount netapp2:/exports/http && sleep 2 && mount -o rw,sync,rsize=32768,wsize=32768,intr,hard,proto=tcp,fsc natapp2:/exports /http/var/www/html && /etc/init.d/httpd start' | ||
|
||
## Memcached server status ## | ||
alias mcdstats='/usr/bin/memcached-tool 10.10.27.11:11211 stats' | ||
alias mcdshow='/usr/bin/memcached-tool 10.10.27.11:11211 display' | ||
|
||
## quickly flush out memcached server ## | ||
alias flushmcd='echo "flush_all" | nc 10.10.27.11 11211' | ||
|
||
## Remove assets quickly from Akamai / Amazon cdn ## | ||
alias cdndel='/home/scripts/admin/cdn/purge_cdn_cache --profile akamai' | ||
alias amzcdndel='/home/scripts/admin/cdn/purge_cdn_cache --profile amazon' | ||
|
||
## supply list of urls via file or stdin | ||
alias cdnmdel='/home/scripts/admin/cdn/purge_cdn_cache --profile akamai --stdin' | ||
alias amzcdnmdel='/home/scripts/admin/cdn/purge_cdn_cache --profile amazon --stdin' | ||
|
||
#getnews () { | ||
# curl https://newsapi.org/v2/top-headlines -s -G -d sources=$1 -d apiKey=YourAPIKeyNumber | jq -r '.articles[] | .title, .url, ""' | ||
#} | ||
|
||
extract() { | ||
if [ -z ${1} ] || [ "$1" = "-h" ] || [ "$1" = "--help" ]; then | ||
echo "Usage: extract <archive> [directory]" | ||
echo "Example: extract presentation.zip." | ||
echo "Valid archive types are:" | ||
echo "tar.bz2, tar.gz, tar.xz, tar, bz2, gz, tbz2," | ||
echo "tbz, tgz, lzo, rar, zip, 7z, xz, txz, lzma and tlz" | ||
else | ||
case "$1" in | ||
*.tar.bz2|*.tbz2|*.tbz) tar xvjf "$1" ;; | ||
*.tgz) tar zxvf "$1" ;; | ||
*.tar.gz) tar xvzf "$1" ;; | ||
*.tar.xz) tar xvJf "$1" ;; | ||
*.tar) tar xvf "$1" ;; | ||
*.rar) 7z x "$1" ;; | ||
*.zip) unzip "$1" ;; | ||
*.7z) 7z x "$1" ;; | ||
*.lzo) lzop -d "$1" ;; | ||
*.gz) gunzip "$1" ;; | ||
*.bz2) bunzip2 "$1" ;; | ||
*.Z) uncompress "$1" ;; | ||
*.xz|*.txz|*.lzma|*.tlz) xz -d "$1" ;; | ||
*) echo "Sorry, '$1' could not be decompressed." ;; | ||
esac | ||
fi | ||
} | ||
|
||
|
||
##sudo last comand | ||
alias please=sudo !! | ||
|
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# | ||
# ~/.bash_profile | ||
# | ||
|
||
[[ -f ~/.bashrc ]] && . ~/.bashrc |
Oops, something went wrong.