How to use asterisk wildcard?

0144

Here’s how to use the asterisk (*) wildcard in a Linux terminal:

  1. Navigate to your directory:

    cd ~/your_directory
  2. List all files:

    ls
  3. List files with a specific extension (e.g., .txt):

    ls *.txt
  4. List files that start with a specific pattern (e.g., files starting with "file"):

    ls file*
  5. List files that contain a specific character or string (e.g., files containing "1"):

    ls *1*
  6. List files with a different extension (e.g., .pdf):

    ls *.pdf

The asterisk wildcard can be used in various positions within the filename pattern to match multiple files based on your criteria.

0 Comments

no data
Be the first to share your comment!