Table of Contents

Join Our Membership To Start Your Cybersecurity Journey Today!

Linux Commands

I just put this Linux Command cheat sheet together very quickly to help those who haven’t had much experience navigating the system.

To start you have to know how the file system is structured so you can navigate it properly. I decided to put a spin on one of the best file system graphics out there. blackMore Ops created an awesome one of a kind linux file system hierarchy that you can find over at blackmoreops.com and I just put a spin on that:To keep this short I’ve only put a fraction of the many possible commands on here but should get you started if you are new to the linux environment.

Lets take a quick look at the structure of the file system:

Roadblock #1: We don’t know what a command does:

To get information about a particular command, we can just put ‘man’ in front of it.

This will come in handy if you get confused about a particular command going forward.

So, if we need to know more about the ‘ls’ command:

root@kali:~# man ls

Roadblock #2: We need the list of files in our current directory

To list the files and folders in your current working directory:

root@kali:~# ls

To get more even details about all the files within the directory:

root@kali:~# ls –a

Roadblock #3: What directory are we in?

If we want to see more information about what directory we are in:

root@kali:~# pwd

Roadblock #4: You need to move directories

To change directory for example from where we are to the /media/ directory:

root@kali:~# cd /media/

No to move back a directory:

root@kali:/media# cd ..

Roadblock #5: You need to make your own directory

Lets say we need to make a new directory called scripts:

root@kali:/# mkdir scripts

Roadblock #6: You need to create and manipulate a file

If we wanted to create a quick file or view a particular file with text we could simply create and then write out (There is of course the original vi but beginners should probably start with nano or leafpad):

root@kali:~# nano ourfile

nanoourfile

To print the contents of that file we just created to the command line:

root@kali:~# cat ourfile

catourfile

We can also make a copy of that file:

root@kali:/# cp ourfile secondfile

cpourfilesecondfile

We may at some point need to move a file from one directory to another. To move ‘ourfile’ to our /scripts/ directory:

root@kali:/# mv ourfile /scripts/

mvourfilescripts

Lets say we want to delete the second file now:

root@kali:/# rm secondfile

 

Now the first:

root@kali:/# rm /scripts/ourfile


rmscriptsourfile

Roadblock #7: You need to remove a directory

We may even want to remove the scripts directory also.

root@kali:/# rmdir /scripts/


rmdirscripts

Roadblock #8: You need to perform some admin functions

While we are root now, we may not always be and may need administrator functionality. We do that with the sudo command.

This will allow us to perform some system admin functions.

There will be times where you need to update your Kali Linux software:

root@kali:/# sudo apt-get update

sudoaptgetupdate

After an update we may need to upgrade as well:

root@kali:/# sudo apt-get upgrade

sudoapt-getupgrade

To become system admin without having to use sudo everytime:

root@kali:/# sudo –s

sudo-s

Roadblock #9: You need to view your network interfaces

You will need to see your network interfaces often. To take look at those:

root@kali:/# ifconfig

ifconfig

If you need to ping a device to probe if it is up:

root@kali:~# ping 127.0.0.1

ping

Roadblock #10: You need to setup new accounts

You will most likely need other user accounts as well. Lets say we wanted to add a user account called howtohackin:

root@kali:~# adduser howtohackin

adduserhowtohackin

These commands are really easy and in an effort not to overwhelm those new to linux we will just leave it here. Along the way however you will get use to these commands and learn many more out of necessity.

Scroll to Top