Presenting to you the most basic and the most useful terminal commands in Kali Linux. May you learn them, use them and do great things with them.
PART ONE: General Commands
1. uname : View information about the current system
Get to know your Linux environment with this command.
2. pwd : Know where you are
This prints the name of the working directory (Print Working Directory)
3. ls : View contents of files and directories
One of the most useful commands to conveniently list all the hidden files of a directory.
Use -l attribute for more detailed output, otherwise use -a attribute.
4. history : Ah! The history command
It lists all the previous commands you entered (stored in bash shell), in case you need to repeat any of them. How convenient!
5. whoami : Who are you, really?
It prints the effective user, ID as in you.
Note: It is different from ‘who’ command which shows information about all users who are currently logged in to the server.
6. macchanger : Become someone else
Change your MAC address (aka your unique traceable identity that links your device to you) through this command to be anonymous.
7. ifconfig : Interface configuration anyone?
View or configure network interface on your system with this command.
8. echo : An utterly basic command
It prints stuff anywhere you want (whether in a file or in a program or on the terminal).
- Use echo [text] > [file name] to print the text in a new file.
- Use echo [text] >> [file name] to print the text in an existing file.
- Using echo [text] without a ‘>’ will automatically create a new file for the text.
9. cat : Short for ‘Concatenate’ (fancy word for linking things together)
View one file (or many), view what’s inside a file, link files together, or copy contents of one file to another. No wonder it is a widely used command in Linux.
10. Clear : Do we even need to explain this? It clears the terminal screen.
PART TWO: Manipulation Commands
11. mkdir : Create directory
If you want to create a directory under Desktop called folder1, open a terminal and type this:
12. cd : Change directory
It is used to change or switch the current working directory. Such a basic one man.
13. cp : Do you copy?
Use this to copy a file (or more). You can also copy a whole directory using this basic command.
PART THREE: Reading Commands
16. more : Displaying stuff one page at a time!
F** scrolling through endless number of lines. Use this command to view the content of a file in a convenient manner. One screen at a time. (Think of Powerpoint versus Word doc).
Test this using the following command:
17. less : Similar to more, but better.
Other that showing the file contents one screen at a time, the less command also uses its brain by not opening the entire file at once.
Test this using the following command:
18. sort : View information in an arranged manner
Confused? Use sort command to view the content in a specific order.
Use -r switch, to sort the contents in reverse order.
PART FOUR: Editing Commands
19. vi : Short for visual editor
Use this text editor by tying vi filename. This editor has two modes (command and insert)
- Enter insert mode by typing ‘i’ and exit by pressing Esc.
- Exit vi by typing ‘:wq’
20. nano : Quite a simple editor.
A command line text editor, GNU Nano comes with most Linux distributions. You can compare it with GUI editors. Try it if you are not a fan of vi or emac.
21. leafpad : Simple, lightweight, easy-to-use editor
A GTK+ text editor, Leafpad is easily compiled, does not depend on many libraries, and is pretty quick to start up.
Command: leafpad /etc/passwd
PART FIVE: Permission Commands
Approaching the end of this blog post, let’s play with some permissions, shall we?
22. chmod : Control who can access your files.
There are flags (permissions) associated with files that decide who can access them and to what extent.
Use the chmod (change mode) command to change the modes of access as you wish. You can either restrict or open access to a file. Makes you feel powerful, doesn’t it?
r = Permission to read the file.
w = Permission to write (or delete) the file.
x = Permission to execute the file or search a directory.
23. chown : Like chmod, like chown.
Files in Linux have 3 major types of access permissions: User, group and other permissions. By default, when a file is created, the owner(user) is the user who created it and the owner(group) is that user’s current group.
With chown (change owner) you can control who can access a file and to what extent.
That’s it for now. Hope you make good use of these commands. Now that you have learnt a lot about how to operate the terminal, don’t be a hoarder and share this information with your friends. What are your top 5 used commands? Tell us in the comment section.
Read more. Know more. Grow more.