LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 11-06-2015, 05:54 PM   #1
greenace92
Member
 
Registered: Nov 2015
Posts: 70

Rep: Reputation: Disabled
How to navigate further into a directory without retyping directories?


For example, I'm trying to get to the directory /a/b/c/d

I'm not sure that d exists so I navigate to c by

cd /a/b/c

then I'm at c

I type ls

I get c

then I would type cd /a/b/c/d

The retyping gets pretty crazy sometimes, I see the .. for navigating within a directory

Thanks for any help
 
Old 11-06-2015, 05:59 PM   #2
Habitual
LQ Veteran
 
Registered: Jan 2011
Location: Yawnstown, Ohio
Distribution: Mojave
Posts: 9,372
Blog Entries: 37

Rep: Reputation: Disabled
Welcome to LQ!
Try
Code:
cd /a/b/c/<tab_for_others>
Real example:
Code:
cd Documents/<I_pressed_tab_key_twice>
Archives/       audio_config/   cirrhus9/       Personal Taxes/ WebSVN.local/
Setup/Test with
Code:
mkdir -pv a/b/c/d
mkdir: created directory a
mkdir: created directory a/b
mkdir: created directory a/b/c
mkdir: created directory a/b/c/d
jj@my-kungfu ~ $ cd a/b/c/<tab_key_x2>
gives me
cd a/b/c/d/

Last edited by Habitual; 11-06-2015 at 06:03 PM.
 
Old 11-06-2015, 06:04 PM   #3
greenace92
Member
 
Registered: Nov 2015
Posts: 70

Original Poster
Rep: Reputation: Disabled
Thanks for the welcome

I am using PuTTY, I tried tab, it lists the directory content.

Unless there is only one folder, then it proceeds forward?

Last edited by greenace92; 11-06-2015 at 06:36 PM.
 
Old 11-06-2015, 06:31 PM   #4
michaelk
Moderator
 
Registered: Aug 2002
Posts: 18,336

Rep: Reputation: 2597Reputation: 2597Reputation: 2597Reputation: 2597Reputation: 2597Reputation: 2597Reputation: 2597Reputation: 2597Reputation: 2597Reputation: 2597Reputation: 2597
As a reference, the directory structure is like a tree with / at the top. If you use a leading / i.e. cd /a/b/c/d then that is called an absolute path. A relative path would be in reference to your current directory and you do not use the leading /. If your current working directory is /a/b/c and you want to go to d then just type in cd d.

The dots you see when you run the ls command are shortcuts. The single . means the current working directory and the .. is the parent. If your current working directory is /a/b/c/d and you want to go back to c then just type cd ..

You can also run the tree command. If not installed you should be able via the distributions repository. It will list the tree structure and files without having to hunt and peck. The following will list all the directories below /a

tree -d /a

This might help a bit...

Last edited by michaelk; 11-06-2015 at 06:33 PM.
 
Old 11-06-2015, 06:36 PM   #5
greenace92
Member
 
Registered: Nov 2015
Posts: 70

Original Poster
Rep: Reputation: Disabled
thank you michaelk

I was typing /d instead of just d, now it works, this is great
 
Old 11-13-2015, 06:03 AM   #6
maples
Member
 
Registered: Oct 2013
Location: IN, USA
Distribution: Arch, Debian Jessie
Posts: 814

Rep: Reputation: 265Reputation: 265Reputation: 265
Also, if you're in directory /a/ and want to go into /a/b/, you can just do
Code:
 cd b/
You don't need to type out the full path every time.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
cannot navigate to /ect directory, anyone? MadAtUbuntu Linux - Newbie 5 12-29-2009 02:58 PM
[SOLVED] xmbc sshfs takes about 1 minute to navigate directories schneidz Linux - Server 3 07-02-2009 01:01 AM
JBuilder+NFS & Can't navigate directories in Open dialogs ibm1130 Linux - Software 0 11-12-2003 11:04 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 09:09 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration