Do I have to type the full name of a directory to navigate to it?

Question

Do I have to type the full name of a directory to change into it every time? It seems like a lot of repeated, unnecessary typing.

Answer

It is unnecessary! Luckily, you can save a lot of time and keystrokes by typing enough of the directory name for it to know which to select and then just press tab.

For example, say you type ls and see that you have three directories available to cd into:
myFolder, yourFolder, myOtherFolder

If you type in myF and then press tab, you’ll see that it autocompletes myFolder! That comes in handy, especially with long file names.

30 Likes

While you do need the full name, and to follow the syntax closely. As mentioned, tab is a useful tool to help save time. Another useful tool is the up-arrow key. This will bring forth commands that you have used earlier that you wish to reuse or modify slightly. This also saves time if you made a mistake in your command and need to edit it, without needing to type out the full command again.

14 Likes

This is so useful that it should be on the regular course. :slight_smile:

11 Likes

Agreed. I found out about the tab-shortcut after trying (and failing) to use the short command from windows cmd prompt (“cd m~” to “cd myFolder” (or whatever file/directory starting with m))

2 Likes