Kali Linux Basics - 1

The Linux File-system

The directories you will find most useful are:

/bin - basic programs (ls, cd, cat, etc.)

/sbin - system programs (fdisk, mkfs, sysctl, etc)

/etc - configuration files

/tmp - temporary files (typically deleted on boot)

/usr/bin - applications (apt, ncat, nmap, etc.)

/usr/share - application support and data files

Basic Linux Commands

MAN - Most executable programs intended for the Linux command line provide a formal piece of

documentation often called manual or man pages

Examples

kali@kali:~$ man ls

kali@kali:~$ man passwd

kali@kali:~$ man -k passwd #if we use the -k option with man, we can perform a keyword search as shown below

kali@kali:~$ man -k '^passwd$' #We can further narrow the search with the help of a regular expression


apropos - With the apropos command, we can search the list of man page descriptions for a possible match based on a keyword


kali@kali:~$ apropos passwd             #Note that apropos seems to perform the same function as man -k


Listing Files - The ls command prints out a basic file listing to the screen

kali@kali:~$ ls

kali@kali:~$ ls -al 


Moving Around - We can use the cd command followed by a path to change to the specified directory.The pwd command will print the current directory


kali@kali:~$ pwd

kali@kali:~$ cd /usr/share/


Creating Directories - The mkdir command followed by the name of a directory creates the specified directory.We can create multiple directories at once with the incredibly useful mkdir -p, which will also create any required parent directories.


kali@kali:~$ mkdir sysnet                #creates a directory called sysnet

kali@kali:~$ mkdir -p test/{recon,exploit,report}

kali@kali:~$ ls -1 test/

exploit

recon

report


Finding Files in Kali Linux - 

which - The which command39 searches through the directories that are defined in the $PATH environment variable for a given file name.

kali@kali:~$ which sbd

/usr/bin/sbd


locate - The locate command40 is the quickest way to find the locations of files and directories in Kali.

kali@kali:~$ sudo updatedb                 #To manually update the locate.db database, you can use the updatedb command

kali@kali:~$ locate sbd.exe


find - The find command41 is the most complex and flexible search tool among the three

kali@kali:~$ sudo find / -name sbd*


Enable Services in Kali Linux


SSH Services


kali@kali:~$ sudo systemctl start ssh #To start SSH Services

kali@kali:~$ sudo ss -antlp | grep sshd #To verify SSH Service 

kali@kali:~$ sudo systemctl enable ssh #Enable SSH at boot


HTTP Service

kali@kali:~$ sudo systemctl start apache2 #To start HTTP Services

kali@kali:~$ sudo ss -antlp | grep apache #To verify HTTP Service 

kali@kali:~$ sudo systemctl enable apache2                 #Enable HTTP at boot


Note :

To see a table of all available services, run systemctl with the list-unitfiles option:

kali@kali:~$ systemctl list-unit-files

We can use systemctl to enable and disable most services within Kali Linux.


Searching, Installing, and Removing Tools


apt update - Information regarding APT packages is cached locally to speed up any sort of operation that involves querying the APT database. Therefore, it is always good practice to update the list of available packages, including information related to their versions, descriptions, etc


kali@kali:~$ sudo apt update


apt upgrade - we can upgrade the installed packages and core system to the latest versions using the apt upgrade command.

kali@kali:~$ apt-cache search pure-ftpd                  #The apt-cache search command displays much of the information stored in the internal cached package database


kali@kali:~$ apt show resource-agents


apt install - The apt install command can be used to add a package to the system with apt install followed by the package name

kali@kali:~$ sudo apt install pure-ftpd


apt remove --purge -The apt remove –purge command completely removes packages from Kali

kali@kali:~$ sudo apt remove --purge pure-ftpd                 # we can remove a package with the command apt remove --purge


dpkg

kali@kali:~$ sudo dpkg -i man-db_2.7.0.2-5_amd64.deb                 #dpkg is the core tool used to install a package, either directly or indirectly through APT.


0 comments:

Post a Comment