Linux command
nstat 命令
文本
复制后可按需替换文件名、目录或参数。
常用示例
Example
nstat
Example
nstat -a
Example
nstat -s
Example
nstat Tcp
Example
nstat -j
说明
nstat displays network statistics from /proc/net/netstat and /proc/net/snmp, showing IP, ICMP, TCP, and UDP counters. By default, it shows only the changes since the last time nstat was run, making it useful for monitoring network activity over time. The tool maintains a history file (~/.nstat.u) to track previous values. Running nstat shows the difference (increment) since the last run, then updates the history. Use -s to view without updating. Statistics include packet counts, errors, retransmissions, and various protocol-specific metrics useful for network troubleshooting.
参数
- -a, --ignore
- Show absolute values (all-time statistics) instead of incremental
- -n, --nooutput
- Don't display header or output (just reset counters)
- -r, --reset
- Reset history
- -s, --noupdate
- Don't update history (show stats without resetting)
- -z, --zeros
- Show entries with zero values
- -j, --json
- Output in JSON format
- -p, --pretty
- Pretty print JSON output (use with -j)
- -d, --scan _INTERVAL_
- Run in daemon mode, collecting statistics every INTERVAL seconds
- -t, --interval _INTERVAL_
- Time interval to average rates (default: 60 seconds)
- -h, --help
- Display help information
FAQ
What is the nstat command used for?
nstat displays network statistics from /proc/net/netstat and /proc/net/snmp, showing IP, ICMP, TCP, and UDP counters. By default, it shows only the changes since the last time nstat was run, making it useful for monitoring network activity over time. The tool maintains a history file (~/.nstat.u) to track previous values. Running nstat shows the difference (increment) since the last run, then updates the history. Use -s to view without updating. Statistics include packet counts, errors, retransmissions, and various protocol-specific metrics useful for network troubleshooting.
How do I run a basic nstat example?
Run `nstat` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does -a, --ignore do in nstat?
Show absolute values (all-time statistics) instead of incremental