En mis scripts, a menudo hago algo como esto al principio en los casos en los que estaré escribiendo archivos temporales:
scratch="$(mktemp -d)"
trap 'rm -fr "$scratch"' EXIT
Todos los archivos o directorios reales se pueden escribir por nombre (e. gramo.mkdir $scratch/foo; touch $scratch/foo/bar
)en el transcurso del guión, pero la limpieza se realiza de inmediato al finalizar el guión con el trap
.
Используйте nload
. Из его справочной страницы:
nload is a console application which monitors network traffic and bandwidth usage in real time. It visualizes the in- and outgoing traffic using two graphs and provides additional info like the total amount of transfered data and min/max network usage.
Еще один полезный инструмент —iptraf
. Из Википедии:
[...] IPTraf has the following characteristics:
IP traffic monitor displays information about network traffic.
General statistics Interfaces.
LAN statistics module that discovers host and displays data about their activity.
Monitor TCP, UDP account showing the network packets for port connections of applications.
Use the "raw socket interface" that takes kernel allowing it to be used by a wide range of "network cards". [sic]