C Programming Tutorial 7 – Intro to UNIX/Linux – Part 2

Don’t forget to read the last blog on Intro to UNIX/Linux Part 1! Are you new here? Start from the beginning of the series!

In the last blog we talked a bit about navigating around Linux  In this blog I wanted to go in a bit more depth. You can imagine the Linux filing system as a tree. When you run pwd, you get the absolute path of where you are. There are important terms relating to paths that you should know.

When someone says the root directory, they are referring to the very first directory. To get to the very first directory you can type:

Another important directory is called the home directory.

This is the directory for your user. This is the default directory that opens when you open a terminal. There is an easier way to go to the home directory though:

The tilde is a trick you can use that refers to your home directory. You can also reference stuff relative to the home directory.

This introduces the concept of relative directories. We can reference a directory in relation to other directories. We actually already did an example of this when we did:

This is saying to move one directory up. We don’t necessarily have to start from the root directory. We can also get more complex… such as:

We are going a bit out of scope of intro to Linux, so let’s get back on track.

Let’s go to the home directory:

We can create a file using:

We can move a file using the mv command. For example:

We can rename a file using this same command:

We can delete a file with:

Conclusion

I think we are going beyond the scope of this blog though, so that’s all I’m going to say for now!

I hope this blog was helpful to you! Check out the next blog as we discuss more on UNIX and Linux!

Did you know that this blog series is also a video series?! Check out the video that goes with this blog, below!

Leave a Reply

Your email address will not be published. Required fields are marked *