我们知道在命令行下,python输出的字符串颜色和一般字符相同,例如windows为黑背景白色字符。若我们想强调某些字符,可以利用下面的代码将要强调部分变为RED色。这个代码在linux下可以,在windows下好像不能用。 1def inred( s ): 2 return"%s[31;2m%s%s[0m"%(chr(27), s, chr(27)) 3print'this is a very '+inred('important')+' thing' 格式: echo "\033……
1. Why? /procinterface is inadequate, unfortunately.When amount of sockets is enough large,netstator even plaincat /proc/net/tcp/cause nothing but pains and curses.In linux-2.4 the desease became worse: even if amountof sockets is small reading/proc/net/tcp/is slow enough.
This utility presents a new approach, which is supposed to scale well. I am not going to describe technical details here and will concentrate on description of the command. The only important thing to say is that it is not so bad idea to load moduletcp_diag, which can be found in directoryModulesofiproute2. If you do not make thissswill work, but it falls back to/procand becomes slow likenetstat, well, a bit faster yet (see section “Some numbers”).
2. Old news In the simplest formssis equivalent to netstat with some small deviations.
1ss -t -adumps all TCP sockets 2ss -u -adumps all UDP sockets 3ss -w -adumps all RAW sockets 4ss -x -adumps all UNIX sockets Option-oshows TCP timers state.……