E.g.:
echo 'alias myip="curl -s "http://checkip.dyndns.org/" | grep -o "[0-9]*\.[0-9]*\.[0-9]*\.[0-9]*" | head -1"' >> /home/USER/.bash_profile
when I type "myip" then I will get my public IP address
Super User is a question and answer site for computer enthusiasts and power users. It only takes a minute to sign up.
Sign up to join this communityHere are a few of my aliases.
when I want to open a file with the GUI, i type go filename
alias go='xdg-open'
reccords the desktop with ffmpeg, and save to the specified file
alias recordDesktop='ffmpeg -f x11grab -s 800x600 -r 25 -i :0.0 -sameq'
Starts a simple http server with python
alias simpleServer='python -m SimpleHTTPServer'
Color in grep :
alias egrep='egrep --color=auto'
alias fgrep='fgrep --color=auto'
alias grep='grep --color=auto'
Aliases for ls
alias ldir='ls -d */'
alias lgrep='ls | grep'
alias l='ls -CF'
alias la='ls -A'
alias ls='ls --color=auto'
alias lx='ls -CFlash'
Start and stop lampp
alias lamppstart='sudo /opt/lampp/lampp start'
alias lamppstop='sudo /opt/lampp/lampp stop'
sl is always fun when you typo ls, but you want to be able to interrupt it, since it's not interruptable by default.
alias sl='sl -e'
Aliases for the vim server
alias vimc='vim --remote-tab-silent'
alias vims='vim --servername VIM'
I have this in my ~/.bash_functions
, to scrape files from a website :
function wget_scrape {
wget -r -l1 -np -A.$1 -nd $2
}
just a note, if you have many aliases, you may want to define them in ~/.bash_aliases
, and add this somewhere in ~/.bashrc
(i think it's there by default in ubuntu) :
if [ -f ~/.bash_aliases ]; then
. ~/.bash_aliases
fi
The only one I have that I really care about (doesn't always do a perfect job though):
cless() {
echo -en '\033]2;Viewing: '"$1"'\007' 1>&2
pygmentize -f terminal "$1" | less -R
}
curl ip.appspot.com