Kali Linux is full of powerful tools, but almost everything you do with it starts in the terminal. If the black window with a blinking cursor feels intimidating, this guide is for you. You don't need to memorize hundreds of commands. About fifteen of them cover most of what a beginner does every day.
Every command below is safe to try in your own Kali virtual machine. If you haven't set one up yet, read my guide on building a safe Kali practice lab first, and take a snapshot before you experiment.
Golden rule: the terminal does exactly what you type, with no "Are you sure?" for most commands. Read a command before you press Enter, especially if it containssudoorrm.
How to read a command
Most commands follow the same pattern:
command -options target
For example, in ls -l /home, ls is the command, -l is an option that changes how it behaves, and /home is the target. If you ever forget how a command works, ask the system itself:
man ls
ls --help
Press q to leave the manual page.
1. Where am I, and who am I?
pwd
whoami
pwd ("print working directory") shows the folder you are currently in. whoami shows which user you are logged in as. Check these whenever you feel lost.
2. Look around: ls
ls
ls -l
ls -la
ls lists the files in the current folder. -l shows details such as size, owner and permissions. -a also shows hidden files, which start with a dot (like .bashrc).
3. Move around: cd
cd Documents
cd ..
cd ~
cd /
cd Documentsgoes into the Documents folder.cd ..goes up one level.cd ~goes to your home folder.cd /goes to the root of the whole system.
Tip: press Tab to auto-complete file and folder names. It saves typing and prevents typos.
4. Create folders and files
mkdir lab
cd lab
touch notes.txt
mkdir makes a new folder, and touch creates an empty file.
5. Read files: cat, head, tail, less
cat notes.txt
head -n 5 /etc/passwd
tail -n 5 /etc/passwd
less /etc/passwd
catprints a whole file.headandtailshow the first or last lines.lesslets you scroll through a long file. Press q to quit.
6. Write text to a file: echo
echo "My first note" > notes.txt
echo "A second line" >> notes.txt
cat notes.txt
A single > replaces the file's contents, while >> adds to the end. Mixing them up is a classic beginner mistake that erases your notes.
7. Copy, move and rename
cp notes.txt backup.txt
mv backup.txt old-notes.txt
mv old-notes.txt ~/Documents/
cp copies a file. mv moves a file, and it is also how you rename one.
8. Delete with care: rm
rm old-notes.txt
rm -r lab
rm deletes files, and -r deletes a folder and everything in it. There is no recycle bin in the terminal, so deleted files are gone. Before you delete, run ls to check exactly what you are about to remove. Never run a command that combines rm -rf with sudo unless you fully understand what it does.
9. Search inside files: grep
grep "kali" /etc/passwd
grep -i "error" notes.txt
grep -n "root" /etc/passwd
grep finds lines containing a word. -i ignores upper and lower case, and -n shows line numbers. It is one of the most useful commands for reading logs and tool output.
10. Find files: find
find ~ -name "notes.txt"
This searches your home folder for a file called notes.txt.
11. Combine commands with a pipe
The pipe symbol | sends the output of one command into another:
ls -l /etc | less
cat /etc/passwd | grep "kali"
This is the idea that makes the terminal powerful: small commands chained together.
12. Permissions: chmod
Every file has permissions for reading (r), writing (w) and executing (x). See them with ls -l. To make a script runnable:
chmod +x myscript.sh
./myscript.sh
Avoid giving everything to everyone with commands like chmod 777. Give only the access that is needed.
13. Admin rights: sudo
sudo apt update
sudo apt full-upgrade -y
sudo runs a command with administrator rights. Use it only when a command needs it, such as installing software or changing system files, and never paste a sudo command from the internet without understanding it first.
14. Check your network: ip a
ip a
This shows your network interfaces and IP addresses. You will use it often to find your lab machine's address before running tools like Nmap on your own network.
15. Clear the screen and reuse commands
clearcleans the terminal (or press Ctrl+L).- Press the Up arrow to bring back previous commands.
- Press Ctrl+C to stop a command that is running.
historylists the commands you typed earlier.
Practice exercise (10 minutes)
Try this in your own Kali VM to put everything together:
cd ~
mkdir practice
cd practice
echo "hello kali" > first.txt
echo "learning linux" >> first.txt
cp first.txt second.txt
ls -l
grep "kali" first.txt
cat first.txt | grep "linux"
cd ..
rm -r practice
Before you run it, predict what each line will do. Then check whether you were right. That habit of predicting first is the fastest way to learn.
Common beginner mistakes
- Typing commands you don't understand. Look them up with
manor the official documentation first. - Running everything as root. Use a normal user, and add
sudoonly when needed. - Forgetting that Linux is case sensitive.
Notes.txtandnotes.txtare different files. - Using
rmcarelessly. There is no undo, so check withlsfirst. - Not taking snapshots. A snapshot lets you undo a mistake in your VM in seconds.
Final thoughts
You don't learn the terminal by reading about it. You learn it by typing. Spend ten minutes a day in your Kali VM with these commands and they will become second nature, which makes every security tool easier to understand later, because those tools are just more commands.
Which should we cover next: Wireshark or a guide to protecting your own accounts? Tell me in the comments, and follow the blog for more guides on Kali Linux, programming, AI and crypto.

No comments:
Post a Comment