I know that WireShark allows live packet capturing as well as details being displayable in the GUI. Is there any similar program that operates on a CLI, rather than a GUI? This is intended for use on a server install, in which only CLI is available (and also where disk space is limited, so much that the dependencies for the wireshark
packages cannot be installed (i.e. the packages for the GUI).
Sure,
tshark
(text shark) is the same program, but with a noninteractive command line interface.You can also run tshark on the server and transfer the captures over ssh to a wireshark gui running somewhere else.
For example:
You can also do
tshark ... |tee packetlog
so it goes both to the screen and to the file.Or, alternatively,
tshark -w stuff.pcap
will write the raw packets into that file, which you can then copy to another machine and open within the wireshark gui, if you want to do more in-depth investigation.tshark is a good option.
An alternative is tcpdump , which is a well-known predecessor. It's widely available on other platforms, so you might run into it even if you don't use it on your server.