Linux main commands in OSCP
find / -name file 2>/dev/null
ls -ltr - Sort list by last modified. -time -reverse
# Remove recursively and its content. Very dangerous command!
List what rights the sudo user has.
# This will send all permissions denied outputs to dev/null.
find / -name file 2>/dev/null
Outputs the path of the binary that you are looking for. It searches through the directories that are defined in your $PATH variable.
# Usually outputs: /bin/bash
cat filename | sort -u > newFileName
64 bytes from 192.168.0.1: icmp_req=1 ttl=255 time=4.86 ms
-d stands for delimiter. and -f for field.
Transform all letter into capital letters
tr "[:lower:]" "[:upper:]" < file1 > file2
# Remove all dots and replace them with underscore.
cat file.txt | tr "." "_"
awk '/search_pattern/ { action_to_take_on_matches; another_action; }' file_to_parse
awk '/172.16.40.10.81/' error.log
We can use the -F flag to add a custom delimiter. : awk -F ':' '{print $1}' test.txt
So if you are manipulating some text you might want to start the output with some info about the columns or something like that. To do that we can use the BEGIN-keyword.
awk 'BEGIN {printf "IP-address \tPort\n"} /nop/ {print $3}' test.txt | head
awk 'BEGIN{printf "IP-address \tPort\n"} /nop/ {print $3} END {printf "End of the file\n"}' test.txt | tail
# Edit or create new cronjobs
Netstat - Find outgoing and incoming connections
Netstat is a multiplatform tool. So it works on both mac, windows and linux.
# Remove one specific rule