Linux System and Process Management Commands : Part 1

uptime

Shows how long the system is running.

$ uptime

22:21:02 up 59 min,  0 users,  load average: 0.52, 0.58, 0.59

top

Displays Linux processes, provides a dynamic real-time view of a running system.

$ top

top - 22:22:42 up  1:01,  0 users,  load average: 0.52, 0.58, 0.59
Tasks:   8 total,   1 running,   7 sleeping,   0 stopped,   0 zombie
%Cpu(s):  4.6 us,  1.6 sy,  0.0 ni, 93.5 id,  0.0 wa,  0.3 hi,  0.0 si,  0.0 st
MiB Mem :  15771.2 total,  10683.2 free,   4864.1 used,    224.0 buff/cache
MiB Swap:  49152.0 total,  49142.2 free,      9.8 used.  10776.5 avail Mem

  PID USER      PR  NI    VIRT    RES    SHR S  %CPU  %MEM     TIME+ COMMAND
    1 root      20   0    9800    600    556 S   0.0   0.0   0:00.15 init
    7 root      20   0    9796    300    248 S   0.0   0.0   0:00.00 init
    8 ajay      20   0   21288   7004   6880 S   0.0   0.0   0:01.79 bash
 1223 ajay      20   0   25468   8748   3836 S   0.0   0.1   0:01.11 vim
 1224 ajay      20   0  651820  47664  15464 S   0.0   0.3   0:00.78 node
 1450 root      20   0    9800    300    252 S   0.0   0.0   0:00.00 init
 1451 ajay      20   0   21284   6976   6868 S   0.0   0.0   0:00.22 bash
 1828 ajay      20   0   18924   2188   1524 R   0.0   0.0   0:00.00 top

htop

It is interactive/scrollable version of top.

free

Display amount of free and used memory in the system.

$ free

              total        used        free      shared  buff/cache   available
Mem:       16149736     5068212    10852172       17720      229352    10947792
Swap:      50331648       10048    50321600

pstree

Shows running processes as a tree.

$ pstree

init─┬─init───bash───vim───node───10*[{node}]
     ├─init───bash───pstree
     └─2*[{init}]

vmstat

vmstat reports information about processes, memory, paging, block IO, traps, disks and cpu activity.

$ vmstat

dstat

Generate/Print system resource statistics

iotop

Displays I/O bandwidth read and written by each process/thread during the sampling period.

sudo iotop

iostat

Shows CPU statistics and input/output statistics for devices and partitions.

netstat

netstat ( short for network statistics) is a command line tool for monitoring network connections both incoming and outgoing as well as viewing routing tables, interface statistics etc.

  • List all Listening ports (TCP and UDP)
netstat -a
  • List only TCP ports connection
netstat -at
  • List UDP port connections
netstat -au
  • List all listening ports
netstat -l
  • List all TCP Listening Ports
netstat -lt
  • Listing all UDP Listening ports
netstat -lu
  • Listing all UNIX Listening Ports
netstat -lx
  • Show statistics by protocol
netstat -s
  • Showing Statistics by TCP Protocol
netstat -st
  • Showing Statistics by UDP Protocol
netstat -su
  • Displaying Service name with PID
netstat -tp
  • Displaying promiscuous mode
netstat -ac
  • Displaying Kernel IP routing
netstat -r
  • Showing Network Interface Transactions
netstat -i
  • Showing Kernel Interface Table
netstat -ie
  • Displaying IPv4 and IPv6 Information
netstat -g
  • Print Netstat Information Continuously
netstat -c
  • Displaying RAW Network Statistics
netstat --statistics --raw

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.