Many of you will be already knowing the importance of Linux in this field of cyber security as we discussed in a previous post. so we're starting this series of the Linux basic for cyber security in this series of post we will complete the basics of Linux for beginner.

So without further delay let's get started. now I will be giving you a brief introduction about most common commands in Linux that you will use in your day to day basis.

Getting info about a command

it can be frustrating sometimes to remember all the options of a particular command so you can use directly use --help or -help it will show a short information about what a command – and the available options out there.

for example
# cd --help code-box
here cd is a command about which we will discuss further in this article.

The Man command

this man command literally means to show manual or document about a particular command or in simple language what does the command does or and how to use it.
# man cd code-box
just use the men followed by the command name to see all the information about what the command does.

Navigating the file system

All the files in a Linux system are stored under the root directory which is at top of the directories hierarchy tree. this root directory is also represented by / character.

so to specify a location in your Linux PC you can write the absolute path of that location which is the full path or the relative path according to your current location.

pwd command (current working directory)

this command is used to print your current working directory in which you are currently in.

#pwd code-box

example output-

# /home/gamersnsp/vedios code-box

so you can see this command print your current folder or directory which were working on.

The cd command (changing directories or folder)

cd command in Linux is used for moving from one folder to another.

# cd code-box

if you use cd without specifying any options or argument it will take you to your home directory.

now for moving to a new location you can specify the full path to that folder like this-
# cd /home/jack/Downloads code-box
or you can use a relative path let's assume that there is a download folder in your current folder so we can directly use this command.
# cd Downloads code-box
and if you want to move to above folder for example if you are in /home/gamersnsp
and wants to move to /home you can use
# cd .. code-box
and if you want to move two folders up 
# cd../../ code-box
and if you want to move to previously working directory you can use - as an argument
# cd -code-box

The ls Command (listing files in a folder )

the LS command is used to show all the files and folder present in a folder and other informations about that files and folders.

# ls code-box
If this command is used without any argument it simply print all the names of the files and folders in an alphabetical order present in your current folder or directory.

we can use it like this to see files of a specific folder just enter the path as an argument.
# ls users/Downloads code-box
example output-
# games user.txt demo.pdf code-box code-box
we can use ls with -l argument to print a formation in long listing format displaying more information like permissions date of creation or modification size of that file.
# ls -l /etc/hosts code-box

-rw-r--r-- 1 root user 337 Dec 4 12:21 /etc/hosts code-box

to display the hidden files we can use -a as an argument
# ls -a code-box
the names of the hidden directory in Linux start with a (.) for example .ssh 

Creating New files in Linux (touch Command)

touch command is a very easy command to create files we just use touch and pass the filename as an argument.
For example-
# touch document.txt code-box

Creating folders in in (mkdir command)

for creating a new folder or directory we can use mkdir command with the folder name.
for example -
# mkdir newfolder code-box
or if you want to specify the location we can use command like this-
# mkdir /home/newfolder code-box

Deleting files and directory (rm command)

for deleting the files we can directly use rm with the filename to delete it for example-
# rm hello.txt code-box
by default this command on delete the folders it will show error to you.
so to delete an empty folder we can -d pass argument
# rm -d download code-box
and delete in an empty folder we can use a command like this with -rf as a argument.
# rm -rf foldername code-box
here -r means for recursive action and -f to ingnore error or prompts.


For this article this much will be enough and we will continue journey to learn Linux for beginners in our part 2 of Linux basics for cyber security .Till then grab your laptop and start practicing it so you can better understand the concept. the more you will practice the more understanding of Linux you will get.

At last don't forget to drop a comment below as it motivates us to write more articles for you guys and thank you and have a nice day.

Previous Post Next Post