Linux – How to have a better view when typing out directories in terminal

bashcommand linelinuxmacosterminal

I am currently using a Mac and learning to use the terminal, but the question applies to Linux systems as well.

I would like to ask, when typing out paths in the terminal/command line, is there a way within the terminal to have a better view of directories ?

For example, I want to cd to a particular directory. Once I start typing the address, is there a way to basically ls at each directory ? If for example I want to copy a file from one directory to another and want to type 2 absolute paths, do I need to memorise 2 paths ? I know that pressing Tab helps with autocomplete, but what if I don't know the first letter ?

Right now I rely on using Finder for that, but I imagine people who use the terminal exclusively have a better way.

Thanks !

Best Answer

Tab is precisely what you need. If you hit tab twice, it will show you all possible completions:

$ cd /usr/  ## Hit tab twice here
bin/     include/ lib64/   sbin/    src/     
games/   lib/     local/   share/   var/     

You don't need to know the first letter, the second tab will show you everything.

Related Question