LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (http://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Is there another way to go to top level? (http://www.linuxquestions.org/questions/linux-newbie-8/is-there-another-way-to-go-to-top-level-4175460704/)

computergirl121 05-04-2013 01:52 PM

Is there another way to go to top level?
 
Is there another way to go from /etc to top level other than by using 'cd /'?

273 05-04-2013 01:55 PM

You could type:
Code:

cd ..
Why are you asking -- what is it you want to achieve?

computergirl121 05-04-2013 02:05 PM

Hello,
I am trying to learn Linux from a book I got from the library. It was explaining top level, I had learned it was 'cd /'.Then the book said there was other ways to get to this location but didn't state what those ways were. That is why I had asked if there was another command. WHEW these Linux commands and levels in security is driving me crazy. LOL. I think I need to take a class. I thought I could self teach due to me knowing Windows. I am going to go on my virtual Fedora and check it out. Thanks

John VV 05-04-2013 06:51 PM

from your normal user $HOME folder
Code:

cd ../../
--- but this is less typing ---
cd /


jefro 05-05-2013 01:10 PM

I had to look that up.

cd either . or .. is normal. Dot and dot dot are current and first upper subdirectory.


cd to some direct place such as / or /bin/usr/ is common also


Somewhat common is plain cd which usually goes back to your /home directory but is set with command.

The most uncommon of all may be the -.

If you were to go from some directory to some then want to go back, you'd then use cd -

There are also ways to change what program cd is and how it acts but most people use the built in cd as is.

Good to know command.

David the H. 05-05-2013 03:55 PM

I'd say there really are no other options. It's just cd with either an absolute or relative path. And frankly there's no need for anything else. In bash running "help cd" will give you a general description of it, and the SHELL BUILTIN COMMANDS section of the the bash man page will give you a bit more. (cd has to be built-in since it has to modify the current shell environment.)

The only other commands available for changing directories, at least in bash, are pushd/popd, and those are really just a directory stack tracking wrapper for cd.

By the way, in case you're wondering . and .. are not some kind of shell built in shortcut but actual directory names. They're hardlinks to the current and parent directory respectively, automatically created by the filesystem.

computergirl121 05-05-2013 04:35 PM

This has helped me a lot. I appreciate your help. Thank you. I love Linux I just never knew it was so advanced behind the scenes. I will conquer this. LOL

PTrenholme 05-06-2013 09:30 PM

There are, however, many other ways to move around the file system. As you are coming from a Windows background, and using Fedora, the easiest way for you might be to start nautilus or gnome-commander so you have a GUI view of things (sort of a grown-up version of the Windows "Computer" page).

Underneath the GUI hood, the cd command will be used, but you won't directly use it. (Technically, the cd command and the GUI programs are both, under their hoods, probably using calls to the Linux chdir function. [I have NOT verified that comment with the source code.:)])

Note also that the alias command can be used to allow you to create your own command to do what you want the way you want to do i. For example, you could enter alias rd 'cd /' command, and then rd would move your current working directory to /. (That alias would only be "active" in your current terminal session. To make permanent alias, you need to create a shell script called bash_alias.sh in /etc/profiles.b/

For example, here is my alias file:
Code:

$ cat /etc/profile.d/bash_alias.sh
#!/bin/bash
alias mounted='mount | grep -v ^[^/] | sort'
alias Mounted='gawk '\''/^\//{print gensub("\\\\040"," ","g",$2)}'\'' /etc/mtab | sort'
alias CIFS='sudo /usr/scripts/mount_cifs.gawk'
alias lsdev='mount | grep ^/dev | sort'
alias ISO='sudo /usr/scripts/mount_iso_images.igawk'


computergirl121 05-08-2013 07:27 PM

Ok I have another question pertaining to this one I posted. Is top the command the same as going to the top level?

273 05-08-2013 07:34 PM

The command "top" shows the "top" processes...
http://unixhelp.ed.ac.uk/CGI/man-cgi?top

computergirl121 05-08-2013 07:47 PM

what is top level?

273 05-08-2013 07:51 PM

Quote:

Originally Posted by computergirl121 (Post 4947497)
what is top level?

I have no idea.

Z038 05-09-2013 12:19 AM

Quote:

Originally Posted by computergirl121 (Post 4947497)
what is top level?

The most common name for the top directory level in a filesystem heirarchy is the root directory, often just referred to as "root". The root directory is an unnamed directory that is denoted by a "/". So "cd /" means "change directory to the root directory".


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