Categories
Linux

Trace Route for an IP

Traceroute command

traceroute 8.8.8.8

IP Route command

ip route get 8.8.8.8

Other commands

ip route list
Categories
Linux

Get Recently installed softwares in Debian

Via command line

cat /var/log/dpkg.log.1 | grep "install"

Categories
Linux

Linux Process basics

List of processes

systemctl list-unit-files | grep enabled
ps aux | less

Top memory consuming process

ps aux --sort -rss | head -11
ps aux --sort +rss | tail -10
ps aux | sort -nrk 3,3 | head -n 5

Top Process ID’s

ps -eo pmem,pcpu,vsize,pid | sort -k 1 -nr | head -5
ps -eo pid,ppid,cmd,%mem,%cpu --sort=-%mem | head

Watch processes

top
watch "ps aux | sort -nrk 3,3 | head -n 5"

CPU info

cat /proc/cpuinfo 

Number of CPU’s

cat /proc/cpuinfo | wc -l
Categories
Linux

Enabling Modules for ReverseProxy

Update package lists:

apt-get update

Install Apache2 with mod_proxy:

sudo apt-get install libapache2-mod-proxy-html

Install libxml2 module:

apt-get install libxml2-dev

On /etc/apache2/apache2.conf add below code

LoadModule  proxy_module         /usr/lib/apache2/modules/mod_proxy.so
LoadModule  proxy_http_module    /usr/lib/apache2/modules/mod_proxy_http.so
LoadModule  headers_module       /usr/lib/apache2/modules/mod_headers.so
LoadModule  deflate_module       /usr/lib/apache2/modules/mod_deflate.so
LoadFile    /usr/lib/x86_64-linux-gnu/libxml2.so

Add a sample reverse proxy configuration to the same file:

ProxyPass /subfolder http://127.0.0.1:9999/
ProxyPassReverse /subfolder http://127.0.0.1:9999/

Restart Apache2:

systemctl restart apache2
Categories
Linux

Basic netstat Command

netstat [OPTIONS]
    (none)
       Default : Displays  a  list of open sockets

    --route , -r
       Display  the kernel routing tables.

   --groups , -g
       Display multicast group membership information for IPv4 and IPv6.

   --interfaces, -i
       Display a table of all network interfaces.

   --masquerade , -M
       Display a list of masqueraded connections.

   --statistics , -s
       Display summary statistics for each protocol.

Netstat command

netstat

Show numerical addresses

netstat -n

Show only tcp connections

netstat -t

Show only udp connections

netstat -u

Show only listening sockets

netstat -l

Show name and PID of programs

netstat -p

Show network statistics

netstat -s

Show kernel routing table

netstat -r

Show listening ports, process, port numbers

netstat -pln

Show listening ports, process, port numbers for TCP

netstat -plnt