Basic command in Kali Linux

This blogs explains basic commands on Kali Linux
There are commands available in Kali Linux for various operations such as file creation, displaying list of files and folders inside directory and many more.

In this blog we will discuss about commands for file creation, displaying content of files and creating directory.
CAT command
We use cat command to create files
Syntax for creating file
cat  >> filename
For example, we use pwd command to check current working directory.
Below screen shot shows /root to be current working directory.
root@kali:~# pwd
/root
We will be using cd command to move into Desktop directory and create a file known as sample1
root@kali:~# cd Desktop/
root@kali:~/Desktop# 
Below is the command to create file sample1 in Desktop/ directory
root@kali:~/Desktop# cat >> sample1
We have to add some content into files after pressing enter key.
root@kali:~/Desktop# cat >> sample1
This is 1st Line
This is 2nd line
This is 3rd line
root@kali:~/Desktop# 
After completing with adding data into files press CTRL D to exit.
Now we will use ls command to check whether file is present in current directory
root@kali:~/Desktop# ls
sample1
We can see that Desktop/ directory contain only single file called ‘sample1’
Now using cat command to display content of sampel1 file
Syntax to use cat command to display content of files.
cat filename
root@kali:~/Desktop# cat sample1
This is 1st Line
This is 2nd line
This is 3rd line
root@kali:~/Desktop# 
 Above is the content of sampel1 file
Creating one more file called sample2 using cat command, adding content into files and at last using CTRL D to exit
root@kali:~/Desktop# cat >> sample2
1lksfdlkss
sljdfnlsg
jnsdfls
kjsdfls
root@kali:~/Desktop#
MKDIR Making Directory
We use mkdir command to create directory.
Syntax
mkdir directory_name
Moving back into root/ directory using cd ..
root@kali:~/Desktop# cd ..
root@kali:~# pwd
/root
We will create new directory “TestDirectory”
root@kali:~# mkdir TestDirectory
Using ls command to display list of files and directories
root@kali:~# ls
Desktop  Documents  Downloads  examples  fiel2  file1  
Music  Pictures  Public  Pythonfiles  sample1  
Templates  TestDirectory  Test.txt  Videos

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s