0% found this document useful (0 votes)
8 views6 pages

Kali Basic

This document provides a comprehensive list of basic and advanced commands for Kali Linux, covering various functionalities such as file management, process management, networking, and archiving. It includes commands for user management, disk and storage operations, and packet management, along with examples and syntax for each command. Additionally, it outlines methods for searching and filtering text, as well as transferring files over SSH.

Uploaded by

sourabhsingh2990
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views6 pages

Kali Basic

This document provides a comprehensive list of basic and advanced commands for Kali Linux, covering various functionalities such as file management, process management, networking, and archiving. It includes commands for user management, disk and storage operations, and packet management, along with examples and syntax for each command. Additionally, it outlines methods for searching and filtering text, as well as transferring files over SSH.

Uploaded by

sourabhsingh2990
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Kali Linux (commands)

Basic :

pwd - shows the current using directory

w –show user and activty

whoami - currect user | who – show all users

echo - to print

clear – clear terminal

nano - simple text editor

vi / vim - advance text editor

man - show mannual page for a commad

help – show command page

alias – create command shortcut | alias update='apt update && apt upgrade'

unalias update – for remove alias

exit - logout / close

ls - list all the file and directory | -l list all the files | - a list all hidden files

cd - change directory

mkdir - making directory | -p make multiple directory

rmdir – remove the empty directory

rm - remove files/directory | - rf remove full files/directory forcefully

cp – copy files /directory

mv – move files/directory

find – search for files | syntax { find -type f filesname –name “*.txt” }

locate – quickly find files using a user database

IMPORTANT

cat - display file content , can add content using > , >>
touch - make a file

less - view file content one page at a time

more - similar to less

head – show first line of the file | –5 print first 5 lines | -c 20 print 20 bytes

tail – show last line of the file | ---------------------| -f for live update

chmod – change permission | +x or read =4 write =2 execute =1

chown – change ownership of file/directory | synta { sudo chown ownerN fileN}

chgrp – change group of file/directory

useradd = make a user | syntax { sudo useradd sourabh}

userdel = del the user

addgroup – to make group

groupdel - to del group

usermod –aG - for make a user part of group | sudo usermod -G sudo,docker $USER –
change the group

passwd – change password

su – switch user

sudo – run as root

PROCESS MANAGEMENT

ps aux - show running processes

top - real –time process viewer

kill- kill process by pid | kill pid | killall - kill process by name

job – show background jobs

Python3 –m [Link] --bind [Link] 8000 & for background job

fg – bring job to foreground | fg %id

bg – take job to background | bg %id

disown – close the job | disown %id


DISK & STORAGE

df –h - disk space usage

du –sh - directory size

lsblk – list block device/ partition

lscpu – cpu details

lspci - hardware pci device

lsusb - usb port / connected usb

systemctl – start/stop or enable/disable

nmcli dev wifi connect "wifi" password "12345"

NETOWRKING

Ping - check network connection

Nsloopkup – dns query | nslookup [Link]

Ifconfig or ip a - show ip address inet

Traceroute – is a network diagnostic tool used to trace the path that packets take from
your computer to a destination

Netstat – tulnp - shows the active ports

Curl – fetch data from url

Wget - download the files

Scp – copy files over SSH

Ssh – remote login

Archiving & Compression


Syntax { tar –cvf fileformat filename }

tar -cvf [Link] dir/ – Create tar archive | tar -xvf [Link] – Extract tar archive

gzip file – Compress file | gunzip [Link] – Decompress gzip

zip - [Link] files – Create zip | unzip [Link] – Extract zip

bzip2 - decompress bz2 zip | bumzip - extract zip

Packet Management

Debian/ ubuntu : apt , apt-get , dpkg – i , sudo mandb, sudo upatedb

Red hat : dnf , yum

Arch linux : pacman

Search & Filters

Grep - search text in file | -i for case-sensitive | -c for count match line | -n show the line
-r recurvsively | -o word only | -v exclude the word

Awk – pattern scanning | -F for delimiter | awk ‘{print $2}’ filename

Cut – extract colums from text | cut –d f for delimiter| -f1,2,3 - is columns

Sed – editor | sed ‘s/sourabh/SOURABH/g’ filename – for temperory | -i for perma

Delete sourabh = sed ‘/sourabh/d’ filename

Sort – sort text | -t for delimiter | -r for reverse | -n for numeric | -u for remove duplicate |
-k1,2 column | -h for human readable size

Uniq - remove duplicate | -c count duplicate | -d show duplicate | -i case-sensitive


-u print only uniq line .

Wc - word/line/byte count | -l line cound | -w word count | -m character count | -c byte


count

Diff - -u file1 file2 difference b/w files

Cmp - file1 file2 compare binary files


For total = awk –F, ‘{sum+=$3} END {print “total : “ sum }’ file
For average = awk –F, ‘{sum+=$3 ; i++} END {print “average :” sum/i} ‘ file
Or
For average = awk –F, ‘{sum+=$3 } END {print “average :” sum/NR} ‘ file
20+ marks = awk –F, ‘$3>20 {print$0}’ file

Sort numerically $3 = sort –t, -k3 –n file


Export num=~/project write echo $num

TRANSFER FILES

first start ssh


scp sourabh@[Link]:/home/sourabh/practices . download from the user

python3 -m [Link] 1234 --bind [Link] to give the access


wget [Link] to get the file from access

nc -lvnp 1234 start the listening


nc [Link] 1234 to connect the listening you can type

You might also like