LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 07-22-2005, 07:32 AM   #1
frankie_DJ
Member
 
Registered: Sep 2004
Location: NorCal
Distribution: slackware 10.1 comfy, Solaris10 learning
Posts: 232

Rep: Reputation: 31
Going to the previous directories - directory history


Is there a command line editing feature that would enable me to move back to a directory that I was in several commands ago?

For example, if I was in

Code:
/usr/games
than I went to

Code:
/home/usr
followed by

Code:
 /opt/src
but now I want to go back to /usr/games by simply typing a key or two.

Thanks
 
Old 07-22-2005, 07:35 AM   #2
Centinul
Member
 
Registered: Jun 2005
Distribution: Gentoo
Posts: 552

Rep: Reputation: 30
What about just pressing up at the command line to get the history?
 
Old 07-22-2005, 08:09 AM   #3
LinuxLala
Senior Member
 
Registered: Aug 2003
Location: New Delhi, India
Distribution: Fedora 7
Posts: 1,305

Rep: Reputation: 45
You can use the up arrow repeatedly. Or if you had used the "cd /usr/games" command you can hit ctrl+r and type usr and it will display the complete command.

You can also try some of the history expansion features of bash.
http://enterprise.linux.com/enterpri...8.shtml?tid=89

Although, for a command so simple/small it'd be too geeky
 
Old 07-22-2005, 08:23 AM   #4
frankie_DJ
Member
 
Registered: Sep 2004
Location: NorCal
Distribution: slackware 10.1 comfy, Solaris10 learning
Posts: 232

Original Poster
Rep: Reputation: 31
Unhappy

Sigh...OK, I'll press the up arrow if I have to
I just thought I read somewhere about this feature. Thanks anyway.
 
Old 07-22-2005, 08:27 AM   #5
Linux~Powered
Member
 
Registered: Jan 2004
Location: /lost+found
Distribution: Slack`er-current
Posts: 845

Rep: Reputation: 33
Code:
cd -
but that only takes you back one directory.

Code:
man cd
 
Old 07-22-2005, 03:01 PM   #6
mikpaul
LQ Newbie
 
Registered: Jul 2005
Location: quebec
Distribution: fedora core 3
Posts: 2

Rep: Reputation: 0
pushd .

put the current directory on top of the stack

then

popd

get you back to the top-on-the-stack directory
 
Old 07-22-2005, 07:31 PM   #7
frankie_DJ
Member
 
Registered: Sep 2004
Location: NorCal
Distribution: slackware 10.1 comfy, Solaris10 learning
Posts: 232

Original Poster
Rep: Reputation: 31
I thought pushd and popd are Cshell features. Let me check it out.
 
  


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
How can I change the directory I am currently in and all directories under it to 755? abefroman Programming 6 10-21-2005 07:15 PM
shell script: delete all directories named directory.# except directory.N brian0918 Programming 3 07-13-2005 07:54 PM
Remove directory and sub directories newuser455 Linux - Newbie 5 06-01-2005 01:31 AM
directory for applications (and directories in general) mr_a_ali Linux - General 6 08-17-2004 06:04 PM
list size of directory and all directories it contains? ubien Linux - General 2 01-11-2003 11:59 AM


All times are GMT -5. The time now is 05:28 AM.

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