Basic Linux Commands
Basic
commands
Date Command –
• This command is generally used to display the system date and time. You can
also set a custom date by typing the below command in your terminal.
• Syntax – “date –set=’2 Apr 2018 16:10′
Basic
commands
Cal Command –
• The cal command simply displays a formatted calendar of current month
in your terminal screen.
Basic
commands
whoami Command –
• The whoami command simply prints the effective user ID where as who
command prints the information about users who are currently logged
in.
Basic
commands
pwd Command –
• pwd stands for “Print Working Directory” which simply prints the name
of the working directory or you can directly use the below command to
use pwd.
Basic commands
ls Command –
• This command is one of the
most useful command in Kali
Linux that lists directory
contents of files and
directories. With ls command,
you can easily list out all
hidden files of a directory
with -a attribute and for more
detailed output you can use -
l attribute.
Basic
commands
cd Command –
• The cd command also known as chdir (Change Directory) is a command
used to change/switch the current working directory.
Basic
commands
mkdir Command –
• The command used for creating directories is mkdir. For example, if you want to create a
directory under Desktop called yeahhub, open a terminal and type the following command:
• Command: mkdir /root/Desktop/yeahhub
Basic
commands
• cat Command –
• The cat (concatenate) command is one of the most frequently used
command in Kali Linux which allows us to create single or multiple files, view
contain of file, concatenate files and redirect output in terminal or files.
Basic
commands
cp Command –
• This command is used to copy files or group of files or directory which
creates an exact image of a file on a disk with different file name.
Basic
commands
• mv Command –
• The mv command moves, or renames, files and directories on your file
system.
Basic
commands
rm Command –
• The rm (remove) command is used to delete files. When used
recursively, it may be used to delete directories.
Basic
commands
• uname Command –
• This command prints the information
about the current system. The uname
command within Linux allows you to
view system information about your
Linux environment.
• With uname -a command, which gives
you more information about the system
like Kernel Name, Node Name, Kernel
Release, Kernel Version, Machine,
Processor, Hardware Platform and
Operating system.
Basic commands
uptime Command –
• The uptime command gives you
the time for which the system
has been up (or
running). Uptime’s basic usage is
very easy – just write the
command’s name and press
enter.
• In case you just want to know the
time for which the system has
been up, and that too in a more
human-readable format, use the
-p command line option.
Basic
commands
users Command –
• This command display login names of users currently logged in on
system.
Basic commands
• less Command –
• less command is used to view
files instead of opening the
file. The less command is
considered to be a more
powerful version of the “more”
command which is used to
display information to the
terminal one page at a time.
• You can view any text file using
the less command simply by
typing the following into a
terminal window: Command:
less /etc/passwd
Basic commands
more Command –
• The more command allows you to
display output in the terminal one
page at a time. This is especially
useful when running a command
which causes a lot of scrolling
such as the ls command or the du
command.
• The more command works with
any application that outputs to
the screen. A good way of testing
this is to type the following into a
terminal window:
• Command: more /etc/passwd
Basic commands
sort Command –
• Sort command sorts the contents
of a text file, line by line. Sort is a
standard command line program
that print the lines of its input or
concatenation of all files listed in
its argument list in sorted order.
• With -r switch, you can sort the
contents of any file in reverse
order.
Basic commands
vi Command –
• The vi editor is a screen editor
which is available on almost all
UNIX systems. In general, vi has
two modes: the command mode
and the insert mode.
• To begin entering text in an
empty file, you must first change
from the command mode to the
insert mode. To do this, type the
letter i. When you start typing,
anything you type will be entered To quit the editor, use the following
into the file. ESC then : WQ
Basic commands
free Command –
• free is a command which can give
us valuable information on
available RAM in Linux machine.
It also gives information about
total used and available space of
physical memory and swap
memory with buffers used by
kernel.
• Free command with -t option,
will list the total line at the end.
Basic commands
• history Command –
• One of the extensively used
command in Kali Linux is
history command. The bash
shell stores a history of
commands entered, which
can be used to repeat
commands by using the
history command.
Updating kali Repository
STEP 1 : SET UP THE REPOSITORY
• we need to change the repository to the official Kali Linux repository. The file required is
located under /etc/apt/sources.list.
• Open the file with leafpad text editor and replace the default repository to this official Kali
Rolling repository:
• deb http://http.kali.org/kali kali-rolling main contrib non-free
• # For source package access, uncomment the following line
• # deb-src http://http.kali.org/kali kali-rolling main contrib non-free
• After that update and upgrade installed Kali Linux packages as
your system, sync your Kali long as it doesn’t have errors on
Linux to the latest version. To dependencies.
do that open the terminal, and
type: • The “apt dist-upgrade” will
update all packages to the
• apt update -y && apt upgrade - newest available version no
y && apt dist-upgrade matter what. And also install
STEP 2: UPDATE and remove dependencies as
needed (install dependencies to
AND UPGRADE • The “apt update” command
downloads and fetches the
satisfy packages, obviously, but
also remove dependencies that
package lists information from became orphaned if a package
YOUR KALI the repositories and “updates”
them to get information on the
that was updated no longer
needed the dependency.
LINUX newest versions of packages
and their dependencies.
• The “apt upgrade” command
downloads and installs newer
version of the packages of
• https://www.yeahhub.com/top-20-
basic-kali-linux-commands/
• https://www.tutorialspoint.com/kali_li
References nux/kali_linux_information_gathering_
tools.htm