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

In the last video we talked a bit about navigating around Linux. This video 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:

cd /

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:

cd

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

ls

cd /

cd ~/folderInHomeDirectory

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:

cd ..

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

cd ~/directory

ls ../..

cd ../../directory

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:

cd

we can create a file using:

touch filename.c

ls -la

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

mv filename.c /Directory

We can rename a file using this same command:

cd /Directory

mv filename.c test.c

We can delete a file with:

rm test.c

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

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
HELP ME! http://www.patreon.com/calebcurry

Subscribe to my newsletter: http://bit.ly/JoinCCNewsletter

Donate!: http://bit.ly/DonateCTVM2.

~~~~~~~~~~~~~~~Additional Links~~~~~~~~~~~~~~~

More content: http://CalebCurry.com
Facebook: http://www.facebook.com/CalebTheVideoMaker
Google+: https://plus.google.com/+CalebTheVideoMaker2
Twitter: http://twitter.com/calebCurry

Amazing Web Hosting – http://bit.ly/ccbluehost (The best web hosting for a cheap price!)

Comments

Michael Li says:

I”m new to C language, and these tutorial videos are very helpful. thank you Caleb!

macbook Nissinen says:

How about a Haskell tutorial someday and currying?

Mishari SH says:

why you laugh every 5 seconds ?
{
func Curry(laugh);
printf(” huh “);
for i in “huh”;
return laugh;
printf(“laugh”);
}

MrLinuxdoctor says:

Hello Caleb
Enjoying the Videos for C programming
you have a fun way of teaching and instruction

Hey My last name is Curry also haha
I’m from NC where are you located 🙂

thanks again
I”m having fun! Learning C!

Mithun Kalvala says:

Good job, Caleb. 🙂

five six says:

when i type mv filename.c .. it says ”mv: rename filename to ../lool.c: Permission denied ! whyy

FreeMan37 says:

Thanks!

Marcel Berkien says:

Fantastic! Thank you very much for this great series!

November Graye says:

Thank you so much for your clear and easy to understand tutorials! I’m in school learning C, but couldn’t follow. You really helped me!

 Write a comment

*

Do you like our videos?
Do you want to see more like that?

Please click below to support us on Facebook!