␡
- List Files and Folders
- List the Contents of Other Folders
- List Folder Contents Using Wildcards
- View a List of Files in Subfolders
- View a List of Contents in a Single Column
- View Contents As a Comma-Separated List
- View Hidden Files and Folders
- Visually Display a File's Type
- Display Contents in Color
- List Permissions, Ownership, and More
- Reverse the Order Contents Are Listed
- Sort Contents by Date and Time
- Sort Contents by Size
- Express File Sizes in Terms of K, M, and G
- Display the Path of Your Current Directory
- Change to a Different Directory
- Change to Your Home Directory
- Change to Your Previous Directory
- Conclusion
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