Linux debugging tools you'll love
jvns.ca
jvns.ca
- lsof can also print the list of files open by a process. fuser can tell you which process open a specific file. lsof is mentioned later in the zine though.
- sysdig is not mentioned but is great.
- wireshark/tcpdump/ngrep/etc might be challenging to practically use in the presence of SSL/TLS. you can mitigate this problem by setting up SSL termination at your network perimeter so you can monitor unencrypted traffic.
- additionally to netcat you have curl, httpie and many other clients for similar purposes. in the Chrome developer tools network tab, you can select a request sent when visiting a website and click "Copy as cURL". this will quickly export any request you were making as a cURL command. likewise, proxies like burp also implement this same feature.
sometimes you need to debug DNS problems, that is not covered sadly. I use dig for this purposes but I wonder if there's something better.
if you are going to be using command line utilities, getting acquainted with cat, grep, cut, sed, awk, tail, head, colrm, tr, sort, uniq, comm, wc, etc. is very recommended. ministat is also cool.
then, about java and node... java has excellent profiling tools, including the free jvisualvm tool shipped with Java that does the job for the most part. profiling and debugging node in runtime can be really challenging. specially analyzing node coredumps with mdb_v8 is not for the faint of heart... you need to set up a VM with joyent's SmartOS for this. there's an npm package that simplifies this process called "autopsy". now, flamegraphs might be fine, but i strongly prefer nodegrind + qcachegrind.
https://mitmproxy.org/ is pretty awesome for that type of work.
https://wiki.wireshark.org/SSL#Using_the_.28Pre.29-Master-Se... https://developer.mozilla.org/en-US/docs/Mozilla/Projects/NS...
> bug is happening for a logical reason. there's no magic
> be confident I can fix it
> talk to someone
Those are good steps. IMO "talk to someone" is a critical step but you'll get wildly different results based on the quality of your reference resource. Ms Evans likely has access to someone (or is someone) who clearly knows their stuff. eBPF and other debugging features enabled by modern kernels are not well known by many developers.
But "be confident I can [diagnose] it" is a great first step and if you're persistent you will find the help you need. Sometimes it may take plumbing the depths of SO or IRC to find that help, but it's out there.
My sole piece of advice to folks looking for help: Be specific and help yourself. This means don't come and ask "why is my server slow?!" - it's coming into the conversation telling me the exact symptoms and what you've already tried and where you think the next steps are.
If you are not at that point, you haven't put enough effort in for me to bother. Those are called paid consulting engagements.
I would say most people get this wrong, and end up being ignored over time. The few folks who consistently give me interesting (even if they are trivial and I've seen it before) problems to help them with that they just need a bit of specific knowledge to solve? I look forward to them contacting me.
A good document to read or link from your project's "Contact" section is this FAQ on asking smart questions:
http://www.catb.org/esr/faqs/smart-questions.html
It might not be quite right for your project but for many projects I've been part of it's pretty spot-on, at least as a starting point to avoid the worst of the 'bad' questions. Our IRC bot had a command for linking this to people, haha O:).
Related: http://bash.org/?152037
90% of the time!
If you want less cutesy, here's the related post: https://news.ycombinator.com/item?id=12059156
The content is good (for the 7 pages I was able to follow it), but the comic book delivery is not working as well as her previous blog posts. Not searchable, more difficult to follow.
Bravo, Ms. Jvns!
On the topic of more sophisticated debugging tools I like valgrind and Google's gperftools. These are definitely more difficult to use but I recommend not giving up on them because the pay off is huge. The trick is a) knowing how to run these tools and b) knowing how to read and understand the output. Both can be achieved through practice and RTFM.
You would want to confirm the data received matches the data sent somehow right?
Destination: nc -l -p 1234 > foo
Source: nc destination 1234 < foo
Protip #1: You can also send directories: Destination: nc -l -p 1234 | tar xf -
Source: tar czf - directory | nc destination 1234
Protip #2: pv for progress indicators (pv on one side is enough) Destination: nc -l -p 1234 | pv > foo
Source: pv foo | nc destination 1234
Note: netcat (BSD or GNU variants) syntax varies across unixes and distros. Sometimes it's `nc -l -p 1234`, other times `nc -l 0.0.0.0 1234`. Check your man.You can check for data corruption with md5sum or similar checksumming tools.
Most of all those tools / command, can be achieved with this one tool / command.
Short answer: she did the first zine on paper, and the second one on a tablet.
what about non-tcp/non-udp sockets e.g. sctp ? ss doesn't seem to support that (but i might be mistaken)
The man page refers to it as "ss - another utility to investigate sockets". That doesn't seem to help.
People takes symbols as a totalitarian thing. We are free to skip their imposition and use things as we like. We are still free to do it. Really. We can appreciate the beauty of a rainbow after a rain/sun combination, and not impose our sexual unsolicited demonstrations to anyone because of it. It's just a nature thingy.
We can say "ss" for a program that print sockets stats, and skip remembering Nazis. It's opensource, any skin tone can use, modify and redistribute, ss. We can do it, or, we can stick to bad memories, and name things just and only, as Israeli stuff.
I didn't think about it, and probably the person that did name the program, neither. Anyway, I see your point, the name can bring negative sentiments to some persons which see the daemon in a piece of source code or in an acronym in unrelated context.
Is there a way to make the output not justified to the width of my terminal? The extra whitespace makes it hard to see which rows match up, and also makes it annoying to paste into IM or email.
Challenge accepted:
ss -e | grep uid | gawk 'match($0,/uid:([0-9]+)/,u) {printf "%s user:",$0;system("getent passwd "u[1]" | cut -d: -f1");}'
Not your point, I know, but it was fun.Starting about when? Most of the distros I use are a couple years old, and I don't see "ss" under the package managers.
https://github.com/shemminger/iproute2/commits/master/misc/s...