Handy bash Aliases

   By chris on August 16th 2007 in /dev/rails, /dev/random | 1,476 views

Today I finally got around to editing my .bash_profile to include the following aliases. I find they make general command line use more pleasant.

The first one remaps ls to show a useful amount of information. Never in my lifetime of using computers have I ever wanted ls to output the way it does by default.

The next two just save a couple of characters by removing the cd from their respective command and optimizing the dual backstep (a cool shell script would be one that counts the number of consecutive periods and cd's back that many directories – 1).

The last one is Rails-specific and simply fires up the default server from your Rails project directory.

alias ls=’ls -alh’
alias ..=’cd ..’
alias …=’cd ../..’
alias home=’cd ~’

alias ss=’script/server’

Update: See Sam’s suggestions for fast ls variants below.

3 Responses to “Handy bash Aliases”

  1. sam responded on 20 Aug 2007 at 7:47 pm #

    hey chris, fyi, cd with no args will tak you home. Me, I’ve used
    alias ls=’ls -F’
    alias l=’ls -l’
    alias la=’ls -a’
    alias ll=’ls -la’
    was default on the physics systems, and i’ve never kicked the habit.

  2. Chris responded on 20 Aug 2007 at 8:16 pm #

    I like those l* variants, handy stuff. I think I’ll add those in.

  3. Monkey Man responded on 17 Oct 2007 at 7:14 am #

    My favourite is

    alias lt=”ls -lt $1 |head”