In this blog, weโll walk through 12 super useful Kali Linux commands. Weโll keep things simple, beginner-friendly, and realโbecause learning should be fun, not scary! ๐
Letโs dive into:
tac
od
od --all
sleep
uft
head
tail
sort
lsof
lspci
grep
1. tac
: Print File in Reverse
While cat
displays a file’s contents from top to bottom, tac
does the oppositeโit shows the lines from bottom to top.
๐ Syntax:
tac filename.txt
๐ Example:
Suppose you have a file lines.txt
with the following lines:
Line One
Line Two
Line Three
Run:
tac lines.txt
๐ฅ๏ธ Output:
Line Three
Line Two
Line One
โ Use Case:
Useful for reading logs in reverse order or analyzing data bottom-up.
2. od
: Octal Dump
od
(Octal Dump) lets you view binary data in human-readable format like hexadecimal, octal, or ASCII.
๐ Syntax:
od filename
๐ Example:
echo "hello" > demo.txt
od demo.txt
๐ฅ๏ธ Output:
0000000 150 145 154 154 157 012
0000006
Each number represents a character in ASCII.
3. od --all
: Full Format Dump
You can use od
with the --format=all
(or simply --all
) option to see data in all common formats: hexadecimal, octal, ASCII, etc.
๐ Syntax:
od --format=all filename
๐ Example:
od --format=all demo.txt
๐ฅ๏ธ Output includes:
- Character representation
- Octal values
- Hex values
- ASCII values
This is especially helpful in reverse engineering or malware analysis.
4. sleep
: Pause Execution
Need to delay a process? sleep
is your go-to command to pause script execution for a specific time.
๐ Syntax:
sleep [seconds]
๐ Example:
sleep 5
๐ Waits for 5 seconds before executing the next command.
โ Use Case:
Perfect for automating scripts with controlled delays or cooldowns between actions.
5. uft
: โ ๏ธ Possible Mistype?
There is no standard Linux command called uft
. Did you mean:
uftpd
โ a lightweight FTP server?uft
โ as a typo forcut
oruftp
?
Please verify and Iโll update this section. (You can skip this for now if it was a typo.)
6. head
: Display First Lines
Want to quickly preview the top of a file? Use head
!
๐ Syntax:
head filename
By default, it shows the first 10 lines.
๐ Example:
head demo.txt
To show a specific number of lines:
head -n 5 demo.txt
7. tail
: Display Last Lines
The opposite of head
, tail
shows the last lines of a file.
๐ Syntax:
tail filename
๐ Example:
tail -n 3 demo.txt
โ Use Case:
Frequently used for watching log files in real-time:
tail -f /var/log/syslog
8. sort
: Organize Text
Sort the lines in a file alphabetically or numerically.
๐ Syntax:
sort filename
๐ Example:
If names.txt
contains:
Zebra
Apple
Mango
Run:
sort names.txt
๐ฅ๏ธ Output:
Apple
Mango
Zebra
Add -r
to sort in reverse.
9. lsof
: List Open Files
lsof
(List Open Files) shows which files are currently open by processes.
๐ Syntax:
lsof
๐ Example:
lsof -u yourusername
List all open files for a specific user.
Another one:
lsof -i :80
Shows which process is using port 80.
โ Use Case:
Ideal for troubleshooting file locks, open ports, and network issues.
10. lspci
: List PCI Devices
Curious about your hardware? Use lspci
to display information about PCI buses and connected devices.
๐ Syntax:
lspci
๐ Example Output:
00:00.0 Host bridge: Intel Corporation 440FX - 82441FX PMC
00:01.0 VGA compatible controller: VMware SVGA II Adapter
โ Use Case:
Perfect for checking graphics cards, network cards, and more.
11. grep
: Pattern Matching Hero
grep
is one of the most powerful tools in Linux. It searches for patterns (text) inside files.
๐ Syntax:
grep "pattern" filename
๐ Example:
grep "error" /var/log/syslog
This finds all lines that contain the word โerrorโ.
Use with -i
to ignore case:
grep -i "ERROR" syslog
Combine with ps
to find running processes:
ps aux | grep apache
โ Use Case:
- Log analysis
- Keyword search
- Filtering output
Bonus Tips ๐ก
Here are some practical combos and tricks using the above commands:
โค Monitor a Log File for Errors in Real Time:
tail -f /var/log/syslog | grep "error"
โค Wait Before Executing Another Command:
sleep 10 && echo "10 seconds later..."
โค Reverse and Sort a File:
tac names.txt | sort
โค Display Hardware Info:
lspci | grep VGA
Final Words
Learning Kali Linux commands doesnโt have to be overwhelming. Start small, experiment, and use commands like tac
, od
, head
, grep
, and lsof
to get comfortable navigating and managing your system like a pro.
If youโre serious about ethical hacking or system administration, these commands are more than just toolsโtheyโre your daily companions. Bookmark this guide and practice often!
๐ Letโs Connect!
If you enjoyed this post, explore more beginner-friendly tech blogs at hiranmoypati.com. Whether you’re learning ethical hacking, Excel, or growing your digital brandโI’ve got you covered.
Happy hacking, and see you in the next blog! ๐