Use wild card in Linux commands

A wild card is a character that can be used as a substitute for any of a class of characters in a command. It can increase the flexibility and efficiency of our commands.

Star Wild card

ls ab*

The above command will list all file name that start with ab like abc, abcd, ab3ve, ab etc if they exist.

Question Mark Wild card

ls ab?

The above command will list all file name that have three characters in its name & the name must start with ab and the last character will be anything like abc, ab3, abZ etc if they exist.

Square Brackets Wild card

ls ab[123]

The above command will list files that have name like ab1, ab2 and ab3 if they exist.

We can also specify a range for this wild card.

ls ab[a-f]

ls ab[1-9]

ls ab[a-z]

Need Help?

Do you need any help on Linux & Linux Commands? I'm happy to help you.

Contact Me

Recent Posts

  1. Update query order - WordPress
  2. Display featured products - WooCommerce
  3. Remove "Category:", "Tag:", "Author:" from the_archive_title - WordPress
  4. The essential & basic WP-CLI commands for a WordPress developer
  5. Install theme unit test data using WP-CLI - WordPress


Questions / Comments

If you found this article interesting, found errors, or just want to discuss about them, please get in touch.