• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Chapter 20. Using Basic Unix Commands > Using Wildcards in File Names and Direc...

Using Wildcards in File Names and Directories

You've probably noticed that some of the folders contain dozens, if not hundreds of files. If your intention is to locate a specific file, you could type its name. Something like: ls /Users/bonnie/Applications/filename (where "filename" is, type the exact name of the file you're looking for). That's great, but what if you're looking for a file, and you only know part of the name, or you're looking for files that have the .mov extension? When that happens, UNIX lets you incorporate wildcards into the search statement. Wildcards let you add special characters into the search string that instruct UNIX to look for similar files. To list all file names ending with on, type ls *on. The Terminal window displays a listing of all the files that end with the letters on.

Use Wildcards in File Names and Directories

Open the Applications folder, double-click the Utilities folder, and then double-click the Terminal icon.

Type ls file*, and then press Return.

Where file is, type a partial name of a file or extension. In our example, UNIX lists all files that begin with NU.

Click the Close button.


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint