Basic Kali Linux Commands beginners
In this article we will learn essential linux commands that you will be using on the regular basis.Such as creating,deleting,files,directories and many more.So open your terminal:
pwd stands for present working directory.It displays our present working directory and location.
root@zeeroseven:~# pwd /root
cd(change direcroty) command is used to navigate between directories. If you want to change your present directory to some other direcroty like Downloads or anything you can do it with cd.
root@zeeroseven:~# cd Downloads root@zeeroseven:~/Downloads#
Takes you one directory back.
root@seven:~/Desktop# cd .. root@seven:~#
Help is very useful command. There is a help option for every command that you have in linux. It gives all the information about the command and what you can do with it.
root@zeeroseven:~# ls --help Usage: ls [OPTION]... [FILE]... List information about the FILEs (the current directory by default). Sort entries alphabetically if none of -cftuvSUX nor --sort is specified. Mandatory arguments to long options are mandatory for short options too. -a, --all do not ignore entries starting with . -A, --almost-all do not list implied . and .. --author with -l, print the author of each file -b, --escape print C-style escapes for nongraphic characters --block-size=SIZE scale sizes by SIZE before printing them. E.g., `--block-size=M' prints sizes in units of 1,048,576 bytes. See SIZE format below. -B, --ignore-backups do not list implied entries ending with ~ -c with -lt: sort by, and show, ctime (
clear command clears the terminal.
ls command lists all the files and directories in our present working directory.
root@zeeroseven:~# ls Desktop Downloads root
List hidden files and directories
ls -al lists all the hidden files and directories with details like file format,file permission etc.
root@seven:~# ls -al total 156 drwxr-xr-x 22 root root 4096 Oct 18 02:35 . drwxr-xr-x 23 root root 4096 Oct 14 05:02 .. -rw-r--r-- 1 root root 0 Oct 16 02:42 backup.txt -rw------- 1 root root 885 Oct 16 02:21 .bash_history -rw-r--r-- 1 root root 3391 Aug 11 03:03 .bashrc drwx------ 12 root root 4096 Oct 15 12:29 .cache drwxr-xr-x 12 root root 4096 Oct 15 12:29 .config drwx------ 3 root root 4096 Oct 14 05:11 .dbus drwxr-xr-x 5 root root 4096 Oct 18 02:44 Desktop drwxr-xr-x 2 root root 4096 Oct 14 05:11 Documents drwxr-xr-x 2 root root 4096 Oct 14 05:11 Downloads drwx------ 3 root root 4096 Oct 18 02:07 .gconf
Create files with nano
Nano: Nano is a text editor that runs inside your terminal.It is easy to use. Nano command is something that you will find using often.
once you press enter nano is ready to accept your input. *Note: File will be saved in your present working directory. To create file at the beginning type nano filename and press enter. nano filename
root@zeeroseven:~# nano hello.py
- Control+o To save file.
- Control+k To cut text.
- Control+u To undo.
- Control+w to searching plain text inside nano.
- Control+x To exit nano.
- Control+y To previous page.
- Control+v To next page.
- Control+k To next Line.
- Control+p To previous line.
cat command is used to view file content,creating files,merging files etc.
View content of a file with cat
root@zeeroseven:~# cat players
create new file with cat
Press Control+c to exit.
Delete a file
rm command is used to remove files and folders/directories. Syntax is very simple:
rm [file name that you want to delete].
root@zeeroseven:~# rm users.txt
Copy command is easy to use. Copy command is used to make copy of files and directories. Syntax :
cp [name of the file that you want to make copy of] [name of new copy]
root@zeeroseven:~# cp users user
Create Directories or folders
Creating directories is one of the easiest task in linux. Syntax for creating directory is:
mkdir [directory name]
root@zeeroseven:~# mkdir java
We can create multple directories with a single command:
root@zeeroseven:~# mkdir java shell py
Deleting directories is a little different than files.You have to supply -r argument along with rm command in order to delete a file. Syntax:
rm -r [directory that you want to delete]
root@zeeroseven:~# rm -r java
Like rm command we need to supply -r argument to copy directories.
cp -r [name of the file that you want to make copy of] [name of new copy]
root@zeeroseven:~# cp -r users userscopy
Rename files with mv command
mv command is used for two purposes.We can move files from one directory to another and it will rename files or move from one name to another.
root@seven:~# mv file.txt backup.txt
when you execute above command file.txt will be renamed with backup.txt.
View System resources with Top
Top command shows the list of processes running on your system.It gives summary of how much your system resources are being utilized.
which command is used to find where the executable file is located in your file system.
root@seven:~# which firefox /usr/bin/firefox root@seven:~# which ls /bin/ls root@seven:~# which pwd /bin/pwd
whatis command shows the description of the command.
root@seven:~# whatis ls ls (1) - list directory contents root@seven:~# whatis top top (1) - display Linux processes
It shows a manual page for just about any command you can think of. For example if you want to know more about pwd command you can check it's manual page by typing man and command name like this.
root@zeeroseven:~# man pwd
who command displays who is logged on to the system.
root@zeeroseven:~# who root tty7 2015-10-12 01:49 (:0) root pts/0 2015-10-12 01:49 (:0.0)
The cal utility displays a simple calendar in traditional format.
root@zeeroseven:~# cal October 2015 Su Mo Tu We Th Fr Sa 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31