Linux - NewbieThis 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!
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Introduction to Linux - A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
Click Here to receive this Complete Guide absolutely free.
Pathnames that begin with / are absolute paths, regardless in which directory you currently are they are always pointing to the same file/directory. Pathnames without the leading / are relative to the current directory you are currently in.
When you place "/" before the path, it specifies an absolute path; ie the path is read from the root partition ("/" not "/root" which is $HOME for root) rather than a relative path which is read from the current working directory.
So if you were in your user's home directory, this would specify /bin:
You're right, / is root. So you'd use root if you're navigating to a path that begins from root..
If you imagine the file structure like a descending pyramid in the following example:
Then / is root, then var is within root, and log is within var which is in root...
So, when to use the /
If you're located anywhere in the filesystem other than the parent folder. So if your currently sitting inside /var then you can just type cd log and you will get to the log directory.
If you're anywhere else, you'll need to type cd /var/log... unless we complicate matters by using ../.. or such like..
If you're currently sat in /var/log and you wanted to change to the root directory you could type cd ../.. (.. meaning one step below) so in this example changing from /var/log to / would be two steps.. on this basis cd .. would take you to /var.
I hope that makes more sense, but I'm sure someone else will be able to explain it better than me
df -h will show you where everything is sitting. Sounds to me like you have home/username installed in root /. That is why everything starts from there.
If in home/username in terminal. If one uses cd to go a directory. Then the / is not needed.
The linux file structure layout in terminal and permissions were the 1st thing I bothered to learn
which made doing anything else in terminal easy peasy.
I look at the linux file structure like a building with rooms. Root is the building.
He is also the key holder for all locks in the building.
"cd" is a persons legs to walk around in the building. And open a door in the building.
ls"" is the flashlight to look around and see what is sitting in the room and it will even say
what is locked up and what is not. Depending on what switch you set th "ls" flashlight on.
"/" is the Linux equivalent of "C:\" in Windows. It references the root of the drive. This isn't technically accurate since each drive has its own "C:\", "D:\", "E:\", etc in Windows, while in Linux all drives/partitions are mounted in subdirectories of /, but for the purposes of this explanation, assuming one drive and one partition, it's a reasonable way to think about it.
You use "/" the same way you use "C:\", when you're referring to the absolute path of some file/directory. You leave it off when you're using the relative path to that file/directory.
You can think of it like giving somebody directions to your house. An absolute path would be like giving them your full address (123 Warlock Way, Coolcity, AB 12345). They can then look up this address in a mapping program to figure out how to get there from anywhere in the country. A relative path would be like giving them specific directions to get to your house from their house (go east on Canyon Blvd, turn left on Warlock Way, it's the 3rd house on the right).
It might be worth pointing out that root may have multiple meanings.
1) root is the username for the admin account
2) it is also the home directory name of that account, located at /root
3) the root directory is the top level of the directory hierarchy as pointed out by others.
4) the root filesystem is the partition / hard drive that is mounted under the root directory, i.e. under /
Your question's been covered pretty well, but I like that web page because the info you're probably studying is all in one place there, so you don't have to sift through silly things like YouTube videos and so on.