Ifconfig
Ifconfig is used to configure the kernel-resident network interfaces. It is used at boot time to set up interfaces as necessary. After that, it is usually only needed when debugging or when system tuning is needed.
Netstat
Netstat prints information about the Linux networking subsystem
# show all exposes services
netstat -ano | grep 0.0.0.0
Ps
ps displays information about a selection of the active processes.
ps - ef
Htop
htop is a cross-platform ncurses-based process viewer. It is similar to top, but allows you to scroll vertically and horizontally, and interact using a pointing device (mouse). You can observe all processes running on the system, along with their command line arguments, as well as view them in a tree format, select multiple processes and acting on them all at once.
Df
df displays the amount of disk space available on the file system containing each file name argument.
If no file name is given, the space available on all currently mounted file systems is shown. Disk space is shown in 1K blocks by default, unless the environment variable POSIXLY_CORRECT is set, in which case 512-byte blocks are used.
df -m
# usage sample
echo '==============='
echo 'HDD'
df -m | grep /dev/sda1 | awk '{print "Total:" $2 " MB"}'
df -m | grep /dev/sda1 | awk '{print "Available:" $4 " MB"}'
df -m | grep /dev/sda1 | awk '{print "Used:" $5}'
echo '==============='
Ram stat
Script sample
echo '================'
echo 'RAM'
free -m | grep Mem | awk '{print "Total: " $2 " MB"}'
free -m | grep Mem | awk '{print "Used: " $3 " MB"}'
free -m | grep Mem | awk '{print "Free: " $4 " MB"}'
free -m | grep Mem | awk '{print "Shared: " $5 " MB"}'
free -m | grep Mem | awk '{print "Buff: " $6 " MB"}'
free -m | grep Mem | awk '{print "Available: " $7 " MB"}'
Docker
# show live stats
docker stats
# print docker stats to a file
docker stats -a --no-stream >> docker_stats.log
# pretty print
docker stats --all --format "table {{.Container}}\t{{.Name}}\t{{.CPUPerc}}\t{{.MemUsage}}"
0 Comments