Skip to content

Instantly share code, notes, and snippets.

@shercoder
Last active December 17, 2015 17:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save shercoder/5647795 to your computer and use it in GitHub Desktop.
Save shercoder/5647795 to your computer and use it in GitHub Desktop.
Bash Aliases that I think are useful
# I just installed SanDisk 6Gig/s SSD in my Sony VAIO Laptop today.
# I also installed Xubuntu 13.04 on it as well. I have been
# using Ubuntu from almost a year now. I was actually kind of
# getting tired of Ubuntu, it was causing a lot of issues. And yes I
# am well aware of the fact that Xubuntu is technically Ubuntu.
# Anyways that's not why I am writing this gist. I am just creating
# this gist so I can have a reference to my bash aliases file
# and so that other's can use it as an example as well.
# Add more if you have more simple useful aliases.
alias aptget='sudo apt-get'
alias xupdate='sudo apt-get update'
alias xupgrade='sudo apt-get upgrade'
alias cd..='cd ..'
alias svim='sudo vim'
alias ports='netstat -tulanp'
alias ping='ping -c 5'
alias h='history'
# confirmation
alias mv='mv -i'
alias cp='cp -i'
alias ln='ln -i'
# reboot / halt / poweroff
alias reboot='sudo /sbin/reboot'
alias poweroff='sudo /sbin/poweroff'
alias halt='sudo /sbin/halt'
alias shutdown='sudo /sbin/shutdown'
## 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'
# copy a new file onto old file but create a backup of old file as well
cpbk() {
mv $1 $1.bak
cp $2 $1
}
# no more cd ../../../, just do up 3
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
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment