Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I use regular expressions with cd command in mac terminal?

I have a directory which contains the following folders.

How do I use cd command to go to folder which contains Intelligence in its name using regular expression?

mac@saurav 6th Semester ->ls
[CE 655] Engineering Economics
[CT 651] Object Oriented Analysis and Design
[CT 652] Database Management System
[CT 653] Artificial Intelligence
[CT 654] Minor Project
[CT 655] Embedded System
[CT 656] Operating System

like image 630
Saurav Pathak Avatar asked Jan 22 '26 20:01

Saurav Pathak


2 Answers

You can do something like this cd *Intelligence*.

like image 170
Praveen Rewar Avatar answered Jan 25 '26 17:01

Praveen Rewar


cd *Intelligence*

would take you to the directory that first matches this pattern.

Like if there are directories "1 Intelligence", "abc Intelligence" and "bcd Intelligence" in your current directory, it will switch to "1 Intelligence" because it is the first match.

like image 27
Mihir Luthra Avatar answered Jan 25 '26 17:01

Mihir Luthra



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!