Home And Root Directory
Part of the Fundamentals section of Coddy's Terminal journey — lesson 8 of 82.
Two of the most important directories in any Unix-based filesystem are the root directory and the home directory.
Root Directory (/)
The root directory is the top of the entire filesystem. Every file and folder on your system lives somewhere inside it. It is represented by a single forward slash:
cd /From the root, you can reach any location on the system using an absolute path.
Home Directory (~)
The home directory is your personal space in the filesystem. It is where you start when you open a new terminal session. It is represented by the tilde symbol:
cd ~You can always return to your home directory from anywhere using cd ~ or simply cd with no arguments:
cdComparing root and home:
/— the root of the whole system. Everyone shares it.~— your personal home directory. It usually lives at/home/username.
Think of the root as the entire building, and your home directory as your own room inside it.
You can always check where ~ points to by running:
echo ~Challenge
BeginnerNavigate to the root directory using cd /, then confirm your location with pwd.
Hint: The root directory is represented by a single
/. After navigating there,pwdshould output just/.
Cheat sheet
The root directory is the top of the entire filesystem, represented by /:
cd /The home directory is your personal space in the filesystem, represented by ~:
cd ~You can also return to your home directory using cd with no arguments:
cdKey differences:
/— the root of the whole system (shared by everyone)~— your personal home directory (usually at/home/username)
To check where ~ points to:
echo ~Try it yourself
This lesson includes a short quiz. Start the lesson to answer it and track your progress.
All lessons in Fundamentals
4Directories
Create A DirectoryCopy A DirectoryMove And Rename A DirectoryDelete A DirectoryRecap - Directory Operations7File Content
Head And TailWord CountSort CommandUnique CommandGrep BasicsGrep With FlagsRecap - Text Detective2Navigation
Print Working DirectoryList FilesChange DirectoryAbsolute vs Relative PathsHome And Root DirectoryRecap - Find Your Way8Redirection
Standard OutputOverwrite To A FileAppend To A FileStandard InputStandard ErrorRecap - Log Builder6Wildcards And Patterns
The Star WildcardThe Question Mark WildcardBracket WildcardsCombining WildcardsRecap - Selective Operations9Piping
What Is A PipeChaining Two CommandsChaining Multiple CommandsPipe With GrepRecap - Data Pipeline