How can I create a shortcut to CD to my Desktop in a shell script?

0
14
Asked By CraftyLizard88 On

I'm looking for a way to streamline my workflow by creating a command in my shell script that allows me to quickly change directories to my Desktop without having to type out the full 'cd Desktop'. Is there a simple way to set this up?

3 Answers

Answered By SlickPenguin42 On

You could definitely use an alias in your .bashrc file! It’s a simple way to set up a shortcut. Just add a line like `alias D='cd ~/Desktop'`, and afterwards, you can just type 'D' to quickly go to your Desktop.

Answered By CuriousFox93 On

Another option is to use command completion! You might want to also consider more advanced completion options if you frequently navigate around. Setting up a quick alias works well for one-off commands too.

Answered By TechWizard77 On

Using symlinks could be a nifty workaround as well. Just create a symlink to your Desktop with something like `ln -s ~/Desktop d`, then you could just do `cd d`. It adds a bit of customization if you like that route!

CraftyLizard88 -

Thanks! I like the symlink idea too, it could save me some typing.

Related Questions

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.