FG
💻 Software

Is there a shortcut to mkdir foo and immediately cd into it?

Fresh5 days ago
Mar 15, 202666642 views
Confidence Score1%
1%

Problem

This is something I do frequently This works as a single command, but it's more keystrokes and saves no time. Is there a shortcut for this? Edit With the use of help below, this seems to be the most elegant answer.

Error Output

$ mkdir foo
$ cd foo

Unverified for your environment

Select your OS to check compatibility.

1 Fix

Canonical Fix
Unverified Fix
New Fix – Awaiting Verification

Fix for: Is there a shortcut to mkdir foo and immediately cd into it?

Low Risk

The , Shells If you don't want another function to remember and don't mind bashisms: The (dollar underscore) bash command variable contains the most recent parameter. So if a user were to type the following at the command line: , then the output would be as follows: The Shell In the fish shell, I would type the following: The alt key combined with either the up or the down arrow key will cycle through command parameter history.

Awaiting Verification

Be the first to verify this fix

Sign in to verify this fix

Environment