Home > Articles > Open Source > Linux/UNIX/Open Source Operating Systems

  • Print
  • + Share This
This chapter is from the book

This chapter is from the book

List Folder Contents Using Wildcards

ls *

You just learned how to find a file by listing out its entire directory; but there’s a faster method, especially for really long directory listings. If you know that the video of the Bengal Tiger you’re looking for is in Windows Media format (Boo! Hiss!), and therefore ends with .wmv, you can use a wildcard to show just the files ending with that particular extension.

$ ls ~/videos
airhorn_surprise.wmv
apple_knowledge_navigator.mov
b-ball-e-mail.mov
carwreck.mpg
nerdtv_1_andy_hertzfeld
nerdtv_2_max_levchin_paypal
nerdtv_3_bill_joy
tiger.wmv
Ubuntu_Talk-Mark_Shuttleworth.mpeg
$ ls ~/videos/*.wmv
airhorn_surprise.wmv   tiger.wmv

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

$ ls ~/videos/*tiger*
tiger.wmv
  • + Share This
  • 🔖 Save To Your Account