Basic Kali Linux Commands: A Beginner's Guide for Ethical Hacking (Part -5)

Basic Kali Linux Commands: A Beginner’s Guide for Ethical Hacking (Part -5)


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 for cut or uftp?

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! ๐Ÿš€