If it’s your first time viewing this episode of Linux commands explained, I would recommend you to get through the first episode from here.
Today we will learn how to use echo to write words to a file, and copy and move files in Kali Linux using the terminal. We will also talk about how to identify file types in Kali Linux.
echo Command.
Let’s start by explaining what echo is. Echo is a command that displays some text fed to it. Let’s type echo “Hello World” in the terminal and see the output.

We can also use echo to echo out the input to the file using the greater than(>) sign that is., echo hello world > file1.txt

If we do an echo how are you > file1.txt It will overwrite the contents of the file1.txt. If you don’t want to overwrite the contents in file1.txt use ‘>>’. This will append the words that will be echoed into file1.txt.

Copying Files in Kali Linux.
The cp command abbreviates the copy command in Kali Linux. It takes two arguments namely; the file source and destination to where the file is to be copied that is., cp source destination.

We can also use the copy command to copy folders and subfolders. This can be done by using the -r in the copy command that is., cp -r test1 test

So our takeaway today in the copying files is that copy takes two arguments; cp source destination.
Moving Files in Kali Linux.
We move files in Linux using the mv command. Move command just like the copy command takes two arguments that is., mv file1 test1


File command
In Linux, we use the file command to identify the type of file we have and the content it contains that is., file test2.txt

The image below shows how file command can be used to identify different file types;

Hope you enjoyed and learnt something new.
Happy hacking !!
Discover more from TechED Africa
Subscribe to get the latest posts sent to your email.
Leave a comment