Common entries in .bash_aliases

I keep my bash aliases grouped in separate files. I include them from .bashrc like this:

# Alias definitions that should work everywhere
if [ -f ~/.bash_aliases ]; then
    . ~/.bash_aliases
fi

# Alias definitions that are specific to your distro
# e.g. Cygwin-only stuff, apt-get shortcuts on Debian, etc.
if [ -f ~/.bash_aliases.distro-specific ]; then
    . ~/.bash_aliases.distro-specific
fi

This is the ~/.bash_aliases that I commonly use:

# Interactive verbose operation...
alias rm='rm -iv'
alias cp='cp -iv'
alias mv='mv -iv'

# Default to human readable figures
alias df='df -h'
alias du='du -h'

# Misc :)
alias less='less -r'                          # raw control characters
alias whence='type -a'                        # where, of a sort
alias grep='grep --color'                     # show differences in colour
alias egrep='egrep --color=auto'              # show differences in colour
alias fgrep='fgrep --color=auto'              # show differences in colour

# Some shortcuts for different directory listings
alias ls='ls -hF --color=tty'                 # classify files in colour
alias dir='ls --color=auto --format=vertical'
alias vdir='ls --color=auto --format=long'
alias ll='ls -l'                              # long list
alias la='ls -A'                              # all but . and ..
alias l='ls -CF'                              #

This is the ~/.bash_aliases.distro-specific that I use on Debian (or other APT-based distros):

alias show='apt-cache show'
alias search='apt-cache search'

alias files='dpkg -L'
alias selections='dpkg --get-selections'

alias install='sudo apt-get install'
alias reinstall='sudo apt-get install --reinstall'

alias update='sudo apt-get update'
alias upgrade='sudo apt-get upgrade'

alias remove='sudo apt-get remove'
alias purge='sudo apt-get remove --purge'
alias autoremove='sudo apt-get autoremove'

Record and share shell activity via shelr.tv

Terminal

Shelr.tv allows Unix/Linux command line users to record something interesting from their terminal and share it to followers.

It is a bit like YouTube for plain text shellcasts. A great feature is that you can copy and paste everything you see.

A nice intro with interesting comments from one of the core developers can be found on linuxaria.com.

A Debian package has been proposed through the Debian “package mentor” system.

Learning Mac OS X

At my job I am now working to some extent with Mac OS X. My overall impression: Looks good but like Windows it is built on the assumption that “the user should not know how things work”. Some things are done quite elegantly but others are just too dumbed down for my taste.

On the command line the first thing that I noticed was that all the standard folder names start with a capital letter and are more verbose than on Unix. The default shell is bash which is nice for me since I am used to it and know it quite well from Linux.

The version of the Vim editor that comes with OS X is outdated and not very convenient to use. I installed a Vim 7.x build from macvim.org.

I learned about DMG images and that it’s not easy or sometimes even impossible to mount them on Linux. Otherwise mounting was pretty straightforward, for example the SMB share that I use to export my Linux home directory. I could have tried to do the same with NFS but SMB was just easier and I didn’t want to go into the details of uid and guid mapping. Plus, the SMB share is also accessible from the Windows that runs inside a Virtualbox.

One small thing that I don’t like on the Mac is the lack of a “Maximize window” function that maximizes the current window as much as possible. I guess I am not the only one.