Thursday, February 1, 2007

Bash Aliases

Ok I know most Linux users know what bash is, but do we actually use it to its full extent? Bash is very powerful but today I'll keep it simple. Aliases are a great way to either raname or string together commands. Basicly you can execute common commads with arguements or simply rename a command to better suite you. I use them for the simplest of commands. Not to mention this makes it easier to remember more difficult commands Anyways look at mine to get a example of what i mean.

#These are my root commands, useful for common package manager tasks
alias pkgupgrade='pacman3 -Syu'
alias pkginstall='pacman3 -S'
alias pkgremove='pacman3 -Rsc'
alias pkgsearch='pacman3 -Ss'
alias pkgaur='makepkg -i'
alias pkgclean='pacman3 -Scc'
alias pkgpretend='pacman3 -Sp'
alias Env-update='source /etc/profile'
alias aurdir='cd /var/abs/local'

#Here are my $USER aliases
alias Screen='screen'
alias dead-screen='killall screen ; screen -wipe'
alias mp3blaster='mp3blaster -f /tmp/irssiblaster'
alias musicmove='mv ~/Downloads/*.mp3 /mnt/storage/Music/'
alias moviemove='mv ~/Downloads/*.mpg /mnt/storage/Video/'
alias convert='mp32ogg *.mp3 && rm *.mp3'

Now I know some of you are thinking that the commands I use for my root are londer than the actual command. Well they aren't! I'll tell ya why, I actually save keystrokes due to tab completion. For instance I would type 'pkgi (tab)' and viola "pkginstall" appears!!! See there is a method to my madness. There are even easier ways to exucute commands that bash offers called "functions", but at the moment I'm not familiar with them sorry. I'll update this post when I learn more.

No comments: