Sunday, June 1, 2008

aliasing how-to

I came up with this solution of easily connecting to networks, and dispensed with a need for any network manager (well, for my home and school networks, otherwise I can just use the terminal to connect to new networks)

what I did:

opened .bashrc with
sudo nano ~/.bashrc
then at the end of the page I added the line:
alias [name of school]="sudo iwconfig essid [essid] key [key] && sudo dhclient wlan0"
so now all I have to do is enter either mis (name of my school) or "home" in the terminal, enter my password, and I connect to the network. I find it a lot more efficient and "fun" :P to do than connecting via the network manager.

also, on a side note:
I also added the line:
alias ls="ls -l --color=always --classify"
to .bashrc so that when I type "ls" it lists it in the long format, colour coded and with classifications. To make these system-wide aliases, add them to the file /etc/bashrc (requires reboot), or for the root user add these lines to /root/.bashrc

This is more one of those "fun to know" kinds of things.

*IMPORTANT* those commands require the quotes to be there, so add the alias lines with quotes around the command

No comments: