List the Contents of Other Folders


ls music

You don't have to be in a directory to find out what's in it. Let's say that you're in your home directory, but you want to find out what's in the music directory. Simply type the ls command, followed by the folder whose contents you want to view, and you'll see this:

$ ls music Buddy_Holly  Clash  Donald_Fagen  new 


In the previous example, a relative path is used, but absolute paths work just as well.

$ ls /home/scott/music Buddy_Holly  Clash  Donald_Fagen  new 


The ability to specify relative or absolute paths can be incredibly handy when you don't feel like moving all over your file system every time you want to view a list of the contents of a directory. Not sure if you still have that video of Tiger Woods sinking that incredible putt? Try this (~ is like an alias meaning your home directory):

$ ls ~/videos Ubuntu_Talk.mpeg      nerdtv_1_andy_hertzfeld airhorn_surprise.wmv  nerdtv_2_max_levchin apple_navigator.mov   nerdtv_3_bill_joy b-ball-e-mail.mov     RPG_Nerds.mpeg carwreck.mpg          tiger_woods_just_did_it.wmv 


Yes, there it is: tiger_woods_just_did_it.wmv.



Linux Phrasebook
Linux Phrasebook
ISBN: 0672328380
EAN: 2147483647
Year: 2007
Pages: 288

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net