Posts

Showing posts with the label Linux

[Linux] Using grep command with pattern input from a file

Image
grep <text pattern> <file to be checked> grep -f<pattern file> <file to be checked> example: grep -f pattern.txt /var/log/apache2/access.log -f to input search patterns one search pattern per line do not include space/enter empty lines at the end - it will result displaying the whole file as it has enter '\r, '\n' characters contents of pattern.txt : /admin/system-monitor/flood-protect HTTP/1.1" 200 582 /admin/system-monitor/flood-protect HTTP/1.1" 200 590

[Linux] View Command Line Histroy on a Linux Computer

List quickly go by with the last 500 commands used on a Linux terminal $ history 

[Linux] Changing Host Name of a Linux Computer

  Edit following files :  Edit  /etc/hostname Edit  /etc/hosts  To view the host name: use  hostname  command 

[Linux] tcpdump - view TCP traffic on Linux

View contents of TCP packet in LINUX : using tcpdump command only shows packets from a specific IP address                 tcpdump src 192.168.5.29 -X  only shows packets to and from specific IP address                 tcpdump host 192.168.5.29 -X  display packets to and from a specific IP address              tcpdump -X dst 192.168.0.122 or src 192.168.0.122  specify interface -i ens33            tcpdump -i ens33 -X dst 172.19.176.145 or src 172.19.176.145     tcpdump -i ens33 -X dst 10.44.57.129 or src 10.44.57.129  display only tcp packets sent from src to dst ip address      tcpdump -i ens33 -X dst 10.44.63.130 and src 10.44.63.229  capture only POST requests on specified network interface '-i ens33'      tcpdump -i ens33 -s 0 -A 't...