Cheatsheet: Difference between revisions

Content added Content deleted
Line 1,142: Line 1,142:
nslookup -debug yahoo.com ==> verbose information like TTL, etc
nslookup -debug yahoo.com ==> verbose information like TTL, etc


=== Misc ===
=== CURL ===

* CURL
curl -I http://domain.com Get HTTP header information
curl -I http://domain.com Get HTTP header information
curl -i http://domain.com Get HTTP header + Body information
curl -i http://domain.com Get HTTP header + Body information
Line 1,176: Line 1,174:
curl https://www.booleanworld.com/ -sSo /dev/null -w 'namelookup:\t%{time_namelookup}\nconnect:\t%{time_connect}\nappconnect:\t%{time_appconnect}\npretransfer:\t%{time_pretransfer}\nredirect:\t%{time_redirect}\nstarttransfer:\t%{time_starttransfer}\ntotal:\t\t%{time_total}\n'
curl https://www.booleanworld.com/ -sSo /dev/null -w 'namelookup:\t%{time_namelookup}\nconnect:\t%{time_connect}\nappconnect:\t%{time_appconnect}\npretransfer:\t%{time_pretransfer}\nredirect:\t%{time_redirect}\nstarttransfer:\t%{time_starttransfer}\ntotal:\t\t%{time_total}\n'


* IPtables
=== IPtables ===


iptables -L ==> List rules
iptables -L ==> List rules
Line 1,191: Line 1,189:




* TCPDump
=== TCPDump ===


sudo tcpdump -s 0 -i ens160 host 10.1.1.1 -v -w /tmp/packet_capture.cap
sudo tcpdump -s 0 -i ens160 host 10.1.1.1 -v -w /tmp/packet_capture.cap
Line 1,201: Line 1,199:




* MTR
=== MTR ===

Provides the functionality of both the ping and traceroute commands.
Provides the functionality of both the ping and traceroute commands.
Prints information about the entire route.
Prints information about the entire route.
Line 1,211: Line 1,210:
mtr --udp google.com UDP datagrams
mtr --udp google.com UDP datagrams


* Traceroute
=== Traceroute ===

traceroute 4.2.2.2 ==> Uses UDP
traceroute 4.2.2.2 ==> Uses UDP
traceroute -n 4.2.2.2 ==> Do not resolve hostnames
traceroute -n 4.2.2.2 ==> Do not resolve hostnames
Line 1,217: Line 1,217:
sudo traceroute -nT 4.2.2.2 ==> Use TCP Syn (Port 80)
sudo traceroute -nT 4.2.2.2 ==> Use TCP Syn (Port 80)


*Netstat
=== Netstat ===

netstat -s
netstat -s
netstat -a Listing all ports (both TCP and UDP)
netstat -a Listing all ports (both TCP and UDP)
Line 1,231: Line 1,232:
netstat -ant
netstat -ant


* PS
=== PS ===
ps -aux Display all processes in BSD format
ps -aux Display all processes in BSD format
ps -eo pid,ppid,user,cmd
ps -eo pid,ppid,user,cmd
Line 1,238: Line 1,239:
ps -eo pid,ppid,cmd,%mem,%cpu --sort=-%cpu | head
ps -eo pid,ppid,cmd,%mem,%cpu --sort=-%cpu | head


* LS
=== LS ===


Append a character to each file name indicating the file type:
Append a character to each file name indicating the file type:
Line 1,259: Line 1,260:
-rw-r--r-- 1 root root 0 Sep 13 14:57 mtrr
-rw-r--r-- 1 root root 0 Sep 13 14:57 mtrr
</pre>
</pre>


* Find Sym Links:
find . -type l -ls
ls -la | grep "\->"


== Troubleshooting ==
== Troubleshooting ==