Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Changing directorys like a stack
#1

Heres a little trick on how to change directorys like a stack with push and pop :)

 

push == add directory to the stack

pop == remote the last directory form the stack

 

The first thing we are going to do is change to a directory with push this done by

entering pushd /path/ as shwon below.

 



Code:
[damian@localhost ~]$ pushd /home/damian/public_html
~/public_html ~
[damian@localhost public_html]$ pwd
/home/damian/public_html
[damian@localhost public_html]$




 

Now you can see that the directory has changed if we wanted to go back a directory we would

pop the directory like popd as shown below.

 



Code:
[damian@localhost public_html]$ pwd
/home/damian/public_html
[damian@localhost public_html]$ popd
~
[damian@localhost ~]$ pwd
/home/damian
[damian@localhost ~]$




 

Well enjoy poping and pushing your directorys :)

Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)