List Folder Contents Using Wildcards


ls ~/videos/*.wmv

You just learned how to find a file in a directory full of files, but there's a faster method. If you knew that the video of Tiger Woods you're looking for was in Windows Media format (Boo! Hiss!) and therefore ended with .wmv, you could use a wildcard to show just the files that end with that particular extension.

$ 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 $ ls ~/videos/*.wmv airhorn_surprise.wmv   tiger_woods_just_did_it.wmv 


There's another faster method, also involving wildcards: Look just for files that contain the word tiger.

$ ls ~/videos/*tiger* 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