Another very handy command is
sudo netstat -atpn
which shows you the processes and owners of open TCP/UDP ports. The argument combination is as weird as "ps aux" that I just memorized it by heart.Another very handy command is
sudo netstat -atpn
which shows you the processes and owners of open TCP/UDP ports. The argument combination is as weird as "ps aux" that I just memorized it by heart.-r everyone needs, but usually -R is a better default since it does not ignore symlinks
-h I practically never use since I'm almost always using grep to find what file I need to further investigate and letting the stuff down the | line deal with it
-o makes sense, kinda, I want to do that in the next stage of the pipe, maybe I have used it once? cant remember
but -w... I feel like I'm missing something there.
I think what you are doing here is search, but -o and -w shine at data extraction and data manipulation. Things you would use Excel for, except on multiple GB files.
If you are not using search, but are using a recursive (-r) grep, then you are feeding a bunch of data to your pipe but don't care what file it came from. I get that... I mirrored the SEC's ftp back when it was ftp... and it's interesting for correlation and name stuff... but that's not going to work because it's freeform, and it's millions of small files... so you are using (large) files with a known format? Something like spectral datasets where the fields are passed with the data prefixed with it's important tags? Maybe logs?
grep -whor '[A-Z][A-Za-z]*Exception' * | sort | uniq -c
for a histogram of exceptions inside logs downloaded from a bunch of nodes.As for -w, my favourite case is https://unix.stackexchange.com/questions/110645/select-lines...
As for -o,
grep -o ........-....-....-....-............
It may look like Morse code, but what it does is greps UUIDs out.My most common grep phrase is grep -iIRn - good for searching in code (when IDE can't find something). You can remove -i if you care about case, but I mostly used it for plsql code, and that's not case-sensitive.
naw, that would be `netstat -lntup` (listening, nummeric, tcp, udp, programm)
your mentioned command shows essentially all currently active tcp network streams. https://explainshell.com/explain?cmd=sudo+netstat+-atpn
btw, glances is even more complete than htop
ss -atpn | column -t
Or pipe into `cat`Chan is a japanese name ending for children, various communities have created several Anime mascots over the years. Theyre generally suffixed with that -tan, as a cute misspronounciation of chan.
https://en.m.wikipedia.org/wiki/OS-tan
Btw, 4tan should be that 4chan mascot. Ive seen it previously on sankaku complex, but its been too many years ago. Cant find it right now.
/Edit: i probably should mention that you shouldnt visit sankaku complex at work. Its very... Questionable with nudity
TCP, UDP, listening ports, user, PID and process name, extended detail.
What's the ultimate netstat?
:-)
htop is my trusted standby. Fell in love with netdata though. https://github.com/firehol/netdata - since we all do our best to stay away from getting shells on the servers, netdata is awesome
It seems to do something very similar to Cockpit, but netdata has way more stuff out of the box.
lsof has a good case to join coreutils.
$ type ls
ls is aliased to `ls --color=auto'
On slow file systems (for instance, think of shared machines with large directories, NFS and heavy load) this can take ages to give output. Instead, if you just call /bin/ls, this call only calls http://man7.org/linux/man-pages/man3/readdir.3.html and thus gives output promptly.