Wednesday, October 28, 2020

Linux Files & Commands Part1

 In this post, I am going to explain some of the Linux files & netstat command. 

/etc/hosts: 

It’s a file in Linux System that stores table of IP address (can be IPv4/IPv6) and host names. It is used to supplement the DNS Server. The entries in /etc/hosts will be like IP address and host name separated by one or more spaces 


/etc/resolv.conf: 

Addresses of DNS Server are store in /etc/resolv.conf. This file can have multiple names severs each in one line. It has nameserver keyword and IP of the DNS nameserver separated by one or more spaces 


~/.ssh/known_hosts: 

Each user in Linux has this file under their home directory. Typically, this contains RSA keys of trusted hosts by respective users. 


/etc/services: 

This file consists of services and associated ports & protocols. It is plain text file and has fields Service Name, Port Number/Protocol Type, and alias service name separated by space 


Files in proc directory: 

proc a directory under root directory in Linux containing information of running processes on the system. Some files in proc directory and their description are given below 

  • /proc/cmdline has details on boot image and parameters passed during the start of the kernel 
  • /proc/meminfo has detailed memory usage including swap memory, cache, page tables etc 
  • /proc/sys/kernel/pid_max has maximum PID allowed on the system 
  • /proc/loadavg has Load average for last one, five & fifteen minutes, Number of CPU/ Processes, Last PID executed 
  • /proc/uptime has two values namely uptime and time spend in idle process 

Netstat Command: 

netstat command is used to print the network information related to the Linux system 

  • netstat -i gives basic information on interfaces like interface name, MTU of interface, RX, TX information in a table format 
  • netstat -r gives information on routing in system in a table format. It has source interface, destination interface, gateway if identifiable and mask 
  • netstat -tln gives list of listening TCP ports with numbers(flag t for TCP protocol, n for number, l for listening) 
  • netstat -tl gives list of listening TCP ports with names instead of numbers 
  • netstat -s give statistical information like packets received, failed, delivered etc for different protocols like IP, ICMP, UDP 
  • netstat -a gives listening & non listening ports as well as sockets 

No comments:

Post a Comment