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

  • Whatever you regularly would type anyway. Better ask for useful bash commands, but I'm pretty sure that's already available somewhere.
    – Daniel Beck
    May 13, 2011 at 16:28
  • Do you only want aliases, or are functions acceptable? May 13, 2011 at 16:38
  • functions could come too, yes!! :) May 13, 2011 at 16:48
  • 2
    You should generally put aliases in ~/.bashrc and not in ~/.bash_profile because aliases are not exported and hence not inherited by child shells.
    – garyjohn
    May 13, 2011 at 17:02
  • 1
    Even simpler: curl ip.appspot.com
    – Graham
    May 13, 2011 at 22:17

2 Answers 2


Here 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
  • recordDesktop.. nice. :) Dec 7, 2014 at 4:19

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.