Shell tip: change to a directory having very long name

by Vivek Gite on June 6, 2007 · 2 comments

Let us say your have a long directory name called "A_VERY_ VERY LONG_ DIRECTORY_NAME_TO_ TYPE _ A _ B _C"...

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)

Featured Articles:

Share this with other sys admins!
Facebook it - Tweet it - Print it -

We're here to help you make the most of sysadmin work. So, subscribe!

{ 2 comments… read them below or add one }

1 MickZA June 6, 2007

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

Reply

2 vivek June 6, 2007

MickZA,

Good example.

Appreciate your post!

Reply

Leave a Comment

You can use these HTML tags and attributes for your code and commands: <strong> <em> <ol> <li> <u> <ul> <blockquote> <pre> <a href="" title="">
What is 7 + 6 ?
Please leave these two fields as-is:
Are you a human being? Solve the simple math so we know that you are a human and not a bot.



Previous post:

Next post: