Linux            

Disk Tools

df: display free disk space

  • df -a Show all mount points
  • df -h "Human-readable" output

fdisk: partition maintenance program

  • fdisk -l List partitions
  • fdisk /dev/sda Start the partition manipulator
  • fdisk -l /dev/sda View the /dev/sda disk partitions
  • fdisk -s /dev/sda2 Check the size of a specific partition

Performance Tools

free: outputs a summary of RAM usage

  • free -m Display memory in megabytes
  • free -h Display memory figures in human-readable form
  • free -t Display a total of all memory figures in each column
  • free -s 3 keep a gap of 3 seconds
  • free -s 3 -c 5 run only a set number of times

lsof: list all files opened by running processes

  • lsof -u username List of all opened files of user
  • lsof -i TCP:port Find out all the running process of specific port
  • lsof -p pid Find out all the running process of specific PID
  • lsof -i4 List all IPv4 network files
  • lsof -i6 List all IPv6 network files
  • lsof -i List all open sockets
  • lsof /path List all processes accessing a particular file/directory

Other

  • top Showing the active processes and other system information
  • htop A newer program compared to top command
  • ctop Provides a concise and condensed overview of real-time metrics for multiple containers
  • vmstat -a Report virtual memory statistics

Network Tools

dig: querying DNS name servers

  • dig google.com Query Domain “A” Record
  • dig google.com +short Drastically cut the output
  • dig google.com MX Query MX Record
  • dig google.com TTL Query TTL Record
  • dig google.com ANY +noall +answer Query ALL DNS Records
  • dig -x 72.30.38.140 +short DNS Reverse Look-up
  • dig @dns_server host lookups at DNS Server
  • dig +trace host Lookup with trace

ip: configuring network interfaces

  • ip addr Display all interfaces with addresses
  • ip link set dev wlan0 {up|down} Take down/up the wireless adapter
  • ip addr add 192.168.1.100/32 dev eth0 Set a static IP and netmask
  • ip address flush dev eth0 Remove all IPs from an interface
  • ip route Display all routes
  • ip -6 route Display all routes for IPv6
  • ip route add default via 192.168.1.1 Add default route via gateway IP
  • ip route add 192.168.0.0/24 dev eth0 Add route via interface
  • ip route get to 8.8.8.8 Get the route used for an destination
  • ip link set dev eth0 address aa:bb:cc:dd:ee:ff Change your mac address
  • ip neighbor show View neighbors (using ARP and NDP)

nmap: security & network scanner

  • nmap host Simple target scan
  • nmap -iL list.txt Scan from a list of targets
  • nmap -O --osscan_guess host OS detection
  • nmap -oN output.txt host Save output to text file
  • nmap -source-port port host Scan a specific port
  • nmap -A host Do an aggressive scan
  • nmap -traceroute host Traceroute
  • nmap -sP 192.168.0.0/24 Ping scan all machines on a class C network
  • nmap -p 22 192.168.0.0/24 Scan for available SSH connections

other

  • iptraf Real-time statistics in ncurses interfaces
  • mtr --report host Debug routing/package loss issues
  • arp -a Address resolution display and control
  • route -n Displays and manipulates the routing table
  • hostname host|ip Displays the domain name for a given IP address and IP address for a given hostname
  • whois domain Fetch all the information related to a website
  • tcpdump Captures the traffic that is passing through the network interface and displays it