🔥 Linux - Shortcut to Quickly Return to Previous Directory Without Typing the Directory Name

Опубликовано: 21 Январь 2025
на канале: Help Video Guru
215
1

Command to switch to last directory - Linux command line shortcut.

Linux - Shortcut to Quickly Return to Previous Directory Without Typing the Directory Name

Happy? Please DONATE via PayPal: http://thankyou.injusta.click

Linux provides a shortcut to quickly return to the previous directory without having to specify the directory name.

You can see from our prompt, that we are currently working in the root media directory. This terminal highlights the directory name in blue.

Lets now change to the root home directory using the cd change directory command.

cd

We type cd and a space,

/

a forward slash for root,

home

the name of the home directory,

[ENTER]

and press enter.

You can see from the prompt that we are now in the root home directory.

Now we can use Linux's shortcut to return to the previous media directory without having to specify the directory name.

cd

We begin as usual by typing cd and a space,

-

But now we simply type dash as our shortcut,

[ENTER]

and press enter.

You can see from the prompt that we are now back in the root media directory.

[UP ARROW][ENTER]

We can now repeat the shortcut and quickly move back and forth between the two directories.