LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   pushd &popd (https://www.linuxquestions.org/questions/linux-newbie-8/pushd-and-popd-603986/)

itsmesee 12-02-2007 04:17 PM

pushd &popd
 
Very new to linux so forgive the stupid questions, but im going through linux with this step by step guide to learning linux and the explaination for pushd & popd is about 1 sentence long and poorly written so could someone give me an idea from a linux idiot perspective as to what this does??

Thanks

btmiller 12-02-2007 04:25 PM

The pushd and popd commands push and pop directories from the directory stack. They are useful because they let you "save your place" in the file system. For example, if you are in /some/big/long/path and you pushd /somewhere/else you will change to /somewhere/else and your original location is pushed onto the stack. When you do popd, you will change back to /some/big/long/path without having to re-type that big long path.

itsmesee 12-02-2007 04:37 PM

So basically its like the previous button on a t.v. remote?
Please forgive me if that sounds stupid..

btmiller 12-02-2007 04:48 PM

Sort of, but it's a stack ... so you can store more than just one item on it for instance, you can do:

Code:

cd /a
pushd /b # /a is pushed onto the stack
pushd /c # /b is pushed onto the stack, which now has [/b,/a]
pushd /d # /c is pushed, stack now has [/c,/b,/a]
popd # changes you to /c, stack now has [/b,/a]
popd # changes you to /b, stack is now [/a]
popd # changes you to /a


itsmesee 12-02-2007 04:56 PM

OH, okay i get it now!
cool thanks.

Also, what are some good basic programs to start installing on a linux system?

thanks for the help

btmiller 12-02-2007 05:02 PM

I should also mention you can use the dirs command to see the list of directories on the stack. You can use popd +n to go to (and pop) the nth entry from the directory stack (counting from the left -- popd -n counts from the right). Pushd and popd are bash built-in commands so if you look at man bash you can read all the documentation on them.

As for good basic programs, it really depends. What do you want to use the system for. Consumer desktop? Scientific workstation? Server of some sort?

itsmesee 12-02-2007 05:22 PM

Im trying to learn how to run a webserver without control panels.. Ive been using whm/cpanel for sometime, but i want to start learning more about running the web server, apache, running vps and such. There are great control panels that do it all for you, but i dont want to depend on them.

I was told and from i can tell its true, that centos is common on webservers. Also its the one my providor uses. So im setting this old pc up as a centos machine right next to my pc and im going to practice logging in and stuff. Whenever i update or move files in cpanel on my web server im going to try and teach myself on my home pc how to do it without a GUI..

btmiller 12-02-2007 10:17 PM

OK, well you'll want to make sure you have Apache installed. If it's not installed, you can install it through yum. To turn it on do:

Code:

service httpd start
and make sure you can connect to it from another machine (if you have a firewall on, you may have to make sure that port 80 is open). The Apache configuration files are in /etc/httpd. I suggest you read the Apache documentation for information about all the thing you can do.

itsmesee 12-02-2007 11:10 PM

Oh boy.. more questions then, what is yum? How does just that little bit of code install apache?


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