In this guide, we will learn how to work with the file system. Let's cut to the chase. We can start by opening the terminal.
Now by default, your shell is looking in the home directory. A shell is a program that processes commands and returns output. A terminal runs a shell. I think it's pretty important to clear up this vocabulary before we move on. We can tell that we are in the current user's home directory by the blue tilde next to your cursor. Well, what if we want to enter the Documents folder? No problem, just type in the command:
There we go. If you take a look at the path now, we can see were are in:
The cd command stands for change directory. Since the tilde represents the current user's home directory, really you can think of the current path like so:
<your user account name>/Documents
Another useful command to use when you're looking around is the pwd command. This command allows you to view the full path to the directory you're in. It's pretty neat! If you give it a try, you should see the following output:
Great! But, what if we want to move up a directory back to our user's home directory? There are a couple ways to get back, but let's start with one of them. Try running the following command:
Once you run this, you should see that our path ~/Documents is back to ~. Now, what if you wanted to move up two directories? Since the user's home directory is within the home directory, which in turn is in the root directory, we can move to the root directory by moving up two levels.
If we run this, you will notice that the tilde changed to a forward slash. How else do we know that we are in the home directory? Run the following command to find out:
If we run this command, all the files and directories in the root directory will be listed.
Likewise, we can navigate back to our user's home directory like so:
cd /home/<your user account name here>
You can also specify absolute paths to directories. For example, if you're currently in the root directory but you want to go to your user's Documents folder, you can do so by:
cd /home/<your user account name>/Documents
This will move the shell to the Documents folder. Fantastic!
And that concludes this part of my blog, Linux Terminal Survival Guide. I hope this series is able to help some of you beginners out there become masters at using the terminal!