My Top 10 Ubuntu Aliases

aka: The Ultimate List of Ubuntu Aliases

Okay, maybe this isn’t the ultimate list, and maybe it’s more than 10, but this is my list of essential, must-have aliases for Ubuntu (or any version of Linux). Aliases are “shortcuts”. For example, if you’re at the command prompt and want to exit, you normally type exit. But I have an alias for the letter e to exit. I cut my typing by 75%!! Do this all throughout your workflow and you’ll seriously wonder how you ever lived without it. Backup your aliases.

By adding these aliases, I have turned 277 characters of typing down to just 35. That’s a reduction of over 87%!!! Finally, I can leave work at 10am. :)

If you want to use an alias in Ubuntu Linux, insert these commands (or any other commands that speed up your workflow) at the bottom of your .profile or .bashrc files:

    alias sp=’sudo pico’
    alias la=’ls -alh’
    alias m=’mutt’
    alias e=’exit’
    alias cdw=’cd /var/www/’

      alias cdb=’cd /var/www/brockangelo/’
      alias cda=’cd /var/www/angeloarchive/’ (if you host multiple websites, replace the “a” with a website identifier. aka, photoshopsamurai = ps)
      alias cdps=’cd /var/www/photoshopsamurai/’

    alias cdn=’cd /usr/local/nagios/etc/’
    alias nr=’sudo /etc/init.d/nagios restart’
    alias ar=’sudo /etc/init.d/apache2 restart’
    alias coffee=’cat > /var/www/brockangelo/coffees.txt’ (I used to have a coffee-counter on my website and I would update the number of coffees my espresso machine had made – you can use this to replace the contents of a text file quickly)
    alias s=’sudo’
    alias aa=’/home/brock/scripts/add_alias.sh’ (I created a shell script to add new aliases by just typing aa – leave a comment if you’d like to download the script)

And here is the code for the shell script:

    #!/bin/bash
    echo Enter the shortcut, or alias, you want to use:
    read SHORTTEXT
    echo Now enter what text you want it to replace:
    read LONGTEXT
    echo “alias $SHORTTEXT=’$LONGTEXT’” >> ~/.profile
    echo “alias $SHORTTEXT=’$LONGTEXT’ was added to your profile. Changes effective after logout/in.”

9 thoughts on “My Top 10 Ubuntu Aliases

  1. Brad Fullmer

    Brock,
    I am newer to Ubuntu, but loves aliases. Please send me the shell script add_alias.sh.
    Thank,s
    Brad Fullmer

  2. Pingback: What's in your bin directory?

  3. Tony

    Thanks for the alias suggestions i especially like typing s instead of sudo. i also added one called sag=”sudo apt-get install” but i would really like to take a look at your aa script :)

  4. Pingback: Add Aliases in Ubuntu Shortcut | Server Cobra

  5. Josh Gachnang

    Hey I made a few modifications to your script. Mainly, I dumped the aliases into ~/.bash_aliases, which is supported in the standard .bash_rc in Ubuntu. I also added a note that you simply need to type ‘bash’ into the terminal for changes to take effect instead of logging in and out. I also set up an alias to the script (and auto-restarting the terminal after the script) for convenience. Here’s my write up:

    http://www.servercobra.com/add-aliases-in-ubuntu-shortcut/

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>