Shell tip: change to a directory having very long name

Let us say your have a long directory name called “A_VERY_ VERY LONG_ DIRECTORY_NAME_TO_ TYPE _ A _ B _C”…

ADVERTISEMENTS

So how do you change to a directory, which is having very long name without typing full name?

Simply use a wildcard character called * as follows
$ cd A_VERY_VERY*

Or type cd A_VERY and hit tab key to complete a directory name 🙂
$ cd A_VERY_VERY (hit tab key)

🐧 Get the latest tutorials on SysAdmin, Linux/Unix, Open Source & DevOps topics via:
CategoryList of Unix and Linux commands
File Managementcat
FirewallCentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
Network Utilitiesdig host ip nmap
OpenVPNCentOS 7 CentOS 8 Debian 10 Debian 8/9 Ubuntu 18.04 Ubuntu 20.04
Package Managerapk apt
Processes Managementbg chroot cron disown fg jobs killall kill pidof pstree pwdx time
Searchinggrep whereis which
User Informationgroups id lastcomm last lid/libuser-lid logname members users whoami who w
WireGuard VPNCentOS 8 Debian 10 Firewall Ubuntu 20.04

ADVERTISEMENTS
3 comments… add one
  • MickZA Jun 6, 2007 @ 14:39

    I recommend appending the last letter as well:

    $ cd A_VERY_VERY*C

    Better example:

    $ cd /usr/lib/fire*10/plugins

    or for total brevity:

    $ cd /us*/li*/fir*10/pl* gets you to same place

    namely /usr/lib/firefox-1.5.0.10/plugins

  • 🐧 nixCraft Jun 6, 2007 @ 16:09

    MickZA,

    Good example.

    Appreciate your post!

  • arman Dec 22, 2014 @ 20:25

    I was looking for this.
    very useful
    thank you

Leave a Reply

Your email address will not be published. Required fields are marked *

Use HTML <pre>...</pre>, <code>...</code> and <kbd>...</kbd> for code samples.