Fahd Aomari Last Edit : December 26, 2023 9:11 PM

Linux Commands inv

pid=$(sudo ps aux | grep -v grep | grep -i adenumeration | awk -v FS=' ' '{print $2}')

cat, short of concatenate. basically it enable you to display content.

less gives you the ability to display the content page a time. good when the fill is big and u don’t want to open it all.

head allows you to view be default the first 10 line of the file. otherwise you can be used with -n <number of line > to customize.

tail opposite of head command, you can look at the last lines of the file. can be used with -n too.

wc , stands for word count. can count how many words or lines…

nl , numbered lines. is just cat command but with numbers for each line.

cut basically allows you to slice a portion of the output, example :

cut -d ' ' -f 1 access.log # im saying consider the delimitier is an empty spice give me the first slice.
#output : 
[2023/10/25:15:42:02]
[2023/10/25:15:42:02]...

sort sort to sort, -n for number. -r for descending sorting

uniq to eliminate redundant output, used with -c can give how many redundant output for each

example:

ubuntu@tryhackme:~/Desktop/artefacts$ cut -d ' ' -f3 access.log | cut -d ':' -f1 | sort | uniq -c | sort -nr
   4992 www.office.com
   4695 login.microsoftonline.com
   1860 www.globalsign.com
   1581 **REDACTED**
   1554 learn.microsoft.com
--- REDACTED FOR BREVITY ---
egrep '^PasswordAuthentication|^#Include' /etc/ssh/sshd_config

Top

see also