DEV Community

Cover image for EP 02 | Start using Terminal
Gayan Kodithuwakku
Gayan Kodithuwakku

Posted on

EP 02 | Start using Terminal

Hello beautiful people! After a long time, here I bring the 2nd Episode of the Linux for Hackers Series.
Actually, I’m really sorry for the delay, I’m dead busy with my university stuff these days. That’s the reason, Anyway, I try to bring new articles as soon as I can…

When it comes to Terminal, It’s the truly wheeled power of Linux. So please don’t use GUI in Linux. You should use Terminal instead of it.

Where you can access Terminal in Kali Linux

So this is the where Terminal is in Kali Linux. Go ahead and click it…

Terminal

So you can see here, Terminal opened up!

So this is the Linux Terminal, and this is how you are supposed to use Linux. Now if you’re coming from the GUI-only world Where all you use is a graphical user interface… Right!!!

fun1

So true, this might seem a little scary. I totally get it!!!
BUT DON’T WORRY!!!

We are going to walk through this, We are going to teach you a few commands here…

I’m going to slowly wing you off the Graphical User Interface.
I’ll put it up side by side…

Actually, watch here. I’m gonna teach your first few Linux commands…
So come on follow along with me…

Image description

So go ahead and have your Linux terminal open and also at the same time double click and open up your Home Directory.

Opened Home Directory and Terminal

I’ll teach you the first few commands by doing something here in the GUI and then doing that same thing in the Linux Terminal.

Now here’s the first thing, what I love about the GUI is that you are always kind of know where you are right! because you can see it!!!

You can see where you are ‘/home/kali/’

So here I’m in my user directory (Home directory). And you can see there is my stuff.

Now, let’s look at the CLI which is Linux Terminal.

Terminal

I don’t see anything here… How do I know I am, We are gonna solve that…
This is our first command! type with me folks!!!

01. pwd (Print Working Directory)

It basically does what we see in the GUI address bar (/home/kali/).
Simply, It tells us where we’re at…
Hey, where am I? Oh! I’m right here!!!
Let’s try it out! type pwd and go ahead and hit enter!

pwd
/home/kali/
Enter fullscreen mode Exit fullscreen mode

Compare terminal result and what we can see in GUI address bar

Bam!!! It shows us the full path of where we are right now!!!…
you can see it exactly to same as the GUI address bar does.

But one thing, I can actually see my Desktop, Document folder, Download folder, Music folder, Pictures folder, Public folder, Template folder and Videos folder in GUI.
I don’t see those in CLI/ Terminal!!!

How do I see those in Terminal…???

Next command!
type with me, It’s ls command!

02. ls (list)

This is pretty simple what it does. It’ll simply list the contents of your current working directory!
It’s gonna list what we see in GUI… Desktop, Document folder…etc.
You wanna see it?
Let’s do it!

ls
Desktop  Documents  Downloads  Music  Pictures  Public  Templates  Videos
Enter fullscreen mode Exit fullscreen mode

ls

Boom!!!
It did everything!

We can see Desktop Documents… all kinds of stuff in Terminal also.

SEE SEE!!! YOU CAN DO ANYTHING IN THE TERMINAL!!!
and it’s faster!!!

Image description

I’ll convince you, don’t worry! let’s keep going!!!

let’s say we want to take a peek inside our desktop folder. I’ll show it first in GUI. I go inside the Desktop folder.

I know you all know how to do that in GUI.

go to inside of the Desktop folder in GUI

I just double-clicked the desktop folder, and I jumped in there…
So, how to do it in the terminal!
Our Next Command! here we go!

03. cd (Change Directory)

It’s going to do exactly what we just did in GUI.
watch let’s do it right now!!!
Just after cd,
I’ll hit space and tell it
what directory do I want to go to…

cd Desktop
Enter fullscreen mode Exit fullscreen mode

cd command

Hey! Did it work???
I don’t know! Let’s see…
Let’s print our working directory!

check cd

We did!!!
Here you can see the current working directory is changed!!!
We did indeed drill down right into the desktop folder and then to see what’s on our desktop as we can see in the GUI. But currently, my Desktop is empty! Let’s see what happens!!!

we can simply type ls command to list the contents!!!

ls in desktop

There’s not anything!!! in both GUI and CLI!!! It’s fine. Because actually, my desktop has nothing!!! cool!!!

Now!!! We’re gonna learn one more command today!
Hang with me!!!

But so far we’ve done a lot,
the pwd command → to see where we are
the ls command → see what’s around us, what’s in our directory
the cd command → to change where we are

But now,
How do we go back!!!???

Because we can do it in GUI easily using the back icon in the left top corner!

back in gui

How do we do it in Terminal?!
It’s actually super easy!!!

so again we gonna type cd

because Back means we gonna change our directory again!!!
type cd and I’ll hit space and type double dot and hit Enter!

cd ..
Enter fullscreen mode Exit fullscreen mode

go backward

Boom! it works!!!
Again we were in our home directory!

Now just for fun!
I wonder what will happen if we keep going backward???
if we type in cd .. again and again??? what will happen??

Okay, let’s do it and check!

Keep going backward

Oh, you can see, instead of home I’m simply at /
And what this is?

It is actually the Root of the file system.
It’s the end.
We reached the end!

And we’ll talk more about that later! In upcoming episodes!

But, just for fun again… just that’s all for fun right!
let’s enter the ls command now!!! at root… (/)

try ls command in the root directory

Boom! you can see now the content list of the root directory…
Huh! A lot of interesting files here…

We’ll talk about all these files later!

Now real quick Quiz for you,
Quiz time

Let’s see you got the idea right!
Q. Assume you’re in the root directory in Linux Terminal. What command or commands would you enter to /home/kali/ directory?

There are 02 options really…
You can do it with one command or you can do it with 02 commands…
Please comment below your answer!!!

I’ll discuss the answer in the very next episode of this series!

Now here we just scratched the surface.
We are going deeper into Linux.
We are gonna prepped and ready to become a hacker.
But don’t that diminish the fact that you did a lot today with this article!

We are moving from GUI to CLI… Specially Hackers like CLI! We love it right!
And we did, pwd, cd, ls… more to come!!!

So if you wanna hack Dev.to platform algorithm, just hit the heart ,unicorn or save and hit the follow button, and also put your comment!
It hacks the algorithm of Dev.to :D.
Ethically!!! Yess!!!

Summary

pwd command → to see where we are
ls command → see what’s around us, what’s in our directory
cd command → to change where we are
cd .. command → to go backward

Top comments (0)