Title: Simple Linux Commands used in Penetration TestingAuthor: ajayverma
A heap of simple linux commands that may prove useful to do basic things.

Requesting a DHCP IP Address

dhclient <interface></interface>
Setting a Static IP Address

ifconfig <interface> <ip address>/<cidr>
route add default gw <gateway IP Address>
echo nameserver <nameserver / Gateway IP Address> > /etc/resolv.conf</nameserver></gateway></cidr></ip></interface>

Enable service at boot

update-rc.d <service> enable
Isolate a particular field (Cutting)

cat <filename> | cut -d <delimiter for each field> -f <field number, other field numbers> > output.txt
Find and replace instances in a file (sed)

cat file.txt | sed -e "s/<instance to find>/<instance to replace it with>/g" > output.txt
Remove End Characters

cat file.txt | rev | cut -c<how many characters you want removed+1> | rev > output.txt
Merge Two Files Side by Side

paste -d" " <first file> <second file> > <output file>
Tar all files in a directory

tar -cvf newtarfile.tar targetdir/
Grep all files in a directory and subdirectory (print path to found files)

grep -H -i -r "Search Text" targetdir/
These are just some simple snippets to get you started. Ton’s more area out there but this can be a handy quick reference for some basics.

Submitted On: 2019-05-30 12:51:21