Tuesday, 9 July 2013

Alias and Directory Listings

Coming from a Windows background, learning Linux is tough. The stock 'ls' (directory listing) is horrid to my eyes. To 'Windows' it up, I use;
ls --color --group-directories-first -al


So I don't have to type that every time, I creat an 'alias';
alias ls='ls --color --group-directories-first -al'

To us ls as originally intended, just enclose it in single quotes;
'ls'
Turns out that this doesn't survive a reboot. Now to play with bash and profile scripts... Yeah - what the?

I pinched the examples here;
http://www.gigamegablog.com/2012/01/29/beaglebone-linux-101-configuring-angstrom-linux/

Apparently the .bashrc is not good enough - you also need the .profile. I believe this has something to do with 'login' or 'non-login' shell;
What is a login or non-login shell?
When you login (type username and password) via console, either sitting at the machine, or remotely via ssh: .bash_profile is executed to configure your shell before the initial command prompt.
But, if you’ve already logged into your machine and open a new terminal window (xterm) inside Gnome or KDE, then .bashrc is executed before the window command prompt. .bashrc is also run when you start a new bash instance by typing /bin/bash in a terminal. 
Of course it is.

No comments:

Post a Comment