How do you cd into the first available folder without typing out the name?
I would advice either to type first few letters and pressing tab. Bash has autocomplete feature that is really useful. If it is only directory in in current path just pressing tab will fill whole directory.
Typing in cd
and pressing tab twice will display all options in current directory.
tab is generally really useful in bash as you have accessible almost all executables at one or two keypresses.
cd *
as suggested above works only if the directory is first in the listing and not hidden. If there is file alphabetically before your directory this cd
won't change your directory at all.
I think I actually figured it out actually
cd *
cd */
But I haven't tested it if there are multiple files and one folder!
As @Rinzwind mentioned in the comments!
Let's say you have three long folders:
/thisislongfolder1
/thisislongfolder2
/thisislongfolder3
If you type the first letter of the file, then hit tab it will autocomplete the file name! CRAZY STUFF!
So in the example above, you can type: t tab and it will autocomplete as much as it can: cd thisislongfolder
(then type the number yourself).
Or you can do cd t*1
would take you into thisislongfolder1
Thank you Rinzwind!
cd $(ls -d */|head -n 1)
ls -d */
lists the directories, head -n 1
gives the first one in this list.