Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to create folder and cd into it with one command

I'm looking for a command that would create a directory and bring me to it directly after, similar to:

$ mkdir project-one-business-dev-2
$ cd project-one-business-dev-2

I don't want to type the project's name twice because it's too long (I know I can use tab, but what if there are similar names?). Maybe only one command can do it.

like image 898
David Avatar asked Dec 19 '25 06:12

David


1 Answers

You can do it like this:

mkdir project-one-business-dev-2 && cd "$_"

for more information check out this post on AskUbuntu

like image 75
James Hart Avatar answered Dec 20 '25 21:12

James Hart