Sunday, September 28, 2008

ls -1

During my day job, I wanted to list files (filenames alone) in a directory, one per line. I tried multiple options,
$ls
$ls -l
$ls -C
$ls -x
None of them worked. I thought it will be simple enough for someone like me who has spent years with linux/unix.

Though the journeyer[1] inside me, instructed me to RTFM, the lazy, lethargic, egoistic developer inside me said - Ok, just try the options you know, it'll work or use `ls' with `cut'.

Wait, I thought for a moment, there should be definitely a simpler way. Suddenly, I decided to ignore the lazy developer and follow the journeyer[1].. It's when I figured out there is
$ls -1
that allows you to list one file per line.

So, extrapolating this, I think if you follow the journeyer, you will explore better, easier ways which will eventually let you do more in less time. This also reminds me that reviewing the tasks we do and see is there is a better, efficient, elegant way to do them is important and it makes us do our job better whatever the job it may be..

[1] - Journeyer - one who has the zest in a tech trip, who explores..

2 comments:

johnnyjacob said...

Ah ! I had the same question .. long back ! :)

Suresh said...

@johnnyjacob: which one how do list filenames? or whether to follow dev or explore?