C Programming Tutorial 6 – Intro to UNIX/Linux – Part 1

Don’t forget to read the last blog on how a C program works! Are you new here? Start from the beginning of the series!

The goal of this blog is to teach you how to do the most basic things inside of a terminal. Now, these commands are going to be the same for UNIX operating systems, like Mac, and also Linux operating systems, like Ubuntu.

This is in a C Programming series, but we are not going to be doing much C for right now. That’s because in order to be successful with C programming, we ought to familiarize ourselves with Linux.

In fact, one of the biggest reasons C became so popular is because it was the standard programming language when UNIX gained popularity. So even if we are not talking directly about C, this content is still extremely relevant. So be patient!

What is UNIX and Linux?

Now, to start off, we should go over what UNIX and Linux are. As a reminder if you are a beginner, an operating system is just software that allows you to work with a computer and does things like manage input and output, memory, etc.

Two popular operating systems include Windows 10 and Mac OS. UNIX and Linux are categories of operating systems. This means that there are multiple UNIX operating system, one of which is Mac OS, and there are multiple Linux operating systems, one of which is called Ubuntu. The difference between UNIX and Linux is not so important right now because Linux is a UNIX-like operating system.

Because they are so similar, often people will be taking about Linux but really it can apply to UNIX operating systems as well. In these blogs, I am using Mac OS, which comes from UNIX, but it is going to be nearly identical for Linux operating systems. This means that if I say UNIX, you can assume Linux as well or the other way around.

Navigating the Terminal

Now one of the biggest thing Linux is known for is the terminal. If we are talking about people who use windows, very few people know how to use the command prompt, but with Linux nearly everybody uses the terminal.

The first thing you should learn how to do is the basic things you do with a mouse.

Just like you can navigate folders visually, you can navigate folders in the command line as well.

To figure out what folder you are in, type:

This location is known as your working directory. PWD stands for print working directory. This gives you the location of where you are, but how do you see what is in this folder?

By the way, a more common name for folders in Linux is directories.

You can get more information with this command:

The l is known as a flag and it changes the output of the program.

There is also:

This is another flag. You can actually combine them:

Think “list long all”

The very first thing you’ll notice is that there are more files that show up. The files starting with a . are known as hidden files and don’t show up by default. They’re usually hidden for a reason so be careful touching them.

The first section of this will list permissions. Don’t worry about that for now, but notice the first letter. A D means it is a directory. That is how you tell if something is a folder or a file! Some terminals will also color code.

How do you Change a Directory?

The directoryname can be considered an argument to the cd command. Arguments are separated by spaces.

There is one more thing I want to teach y’all! When you run ls -la you see two special cases. One is a dot and the other is two dots. The single dot refers to the current directory and the double dot refers to the parent directory. If you run pwd, you can see that the parent directory comes right before the current directory. So in order to move up a directory, you can run:

Alternatively, you can pass in what is known as an absolute path:


I hope this blog was helpful to you! In the next blog we will learn be learning some more useful Linux commands!

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 *