Essential Terminal Commands Every Developer Should Know
trevorlasn.com
trevorlasn.com
> 2. ls
> 3. cat
> 4. head
> 5. awk
> 6. sed
> 7. tail
> 8. chmod
> 9. xargs
> 10. find
Seems like a pretty good list. I wonder if there is anything obvious missing?
awk '{ print $1 }' "$HISTFILE"|sort|uniq -c|sort -rn|head -15
4887 cd
3699 ssh
2461 man
1987 ls
1558 top
1141 less
981 su
905 dc
807 pwd
779 while
750 find
601 apt-cache
529 echo
462 cat
426 emacs
(The above list has been cleaned from my system-specific commands which would not be generally useful for others.)Ah, of course. They forgot the most useful command of all, namely man.
The thing that I find has the biggest useful-to-popularly-known ratio is "tee".
"Here's a hammer, here's a chisel, here's a hand saw aaaand... here's a petrol powered jackhammer with a circular saw attached."
I didn't really understand what it was capable of until I had a colleague use it to parse the output a CLI tool with no actual reasonable machine-readable output - something like a 100 line awk script to turn some hardware vendor's joke of a config tool into output that could be piped into another script. That's when I understood what awk was, and that my colleague might have been the devil.
Anyway, TIL the existence of grep -e.
Maybe if Windows had grown up with the same Unix tools from day one, the story would be different, but as it stands if I want to do cross-platform development, I'd much rather use the tools I know that Windows devs on my team (and community contributors) can also use, so that we're all using the same tooling and everyone can help everyone else when that tooling falls short.
A lot of things in this article are (for better or for worse) "just do X in VS Code" these days, with support for a "project-recommended extensions" file that you check into version control so that folks forking/cloning automatically get told which extensions they will want to get up to speed with the rest of the team. Because if there's a "common" unix command chain, good chance there's an equivalent cross-platform extension for VS Code for it. If it's not already built in of course.
The essential part is knowing how to do get the result you need for yourself, and how to automate the tasks of getting those results using tools that everyone will be able to use if you're doing dev work (paid or as volunteered) for someone else.
Sure, if you have unlimited resources, or your target audience is predominantely Windows (gaming or non-web large enterprise apps), you can worry about Windows. Otherwise, tell them to install WSL and do all you day-to-day work in *nix environment. No one but your CI have to touch Windows.
My point that now, in 2024, there is really no need to bother with both Windows and *nix support, unless you have special requirements. "Cross platform including non-WSL Windows support" is much more complex and limited than "cross platform which requires WSL on windows", and no one should waste their resources on that without a very good reason. It's perfectly fine to require *nix-like OS for your workflows and enjoy the ease and compatibility that this brings to the table.
This is especially important for open-source contributors, too: someone running Mac OS or Linux is going to be heavily discouraged from contributing any scripts if all scripts are required to be Windows-compatible. And someone running Windows might contribute powershell script but that would be useless for non-Windows people, limiting its utility. My advice to everyone is: unless your app is in Windows-heavy niche, drop non-WSL windows support requirement.
And by not using or advocating unix-specific command line utilities, you solve two problems: people don't need to learn commands they don't want to learn, and the tools that you do use tend to be cross-platform by default. Anyone on Windows, Linux, MacOS, FreeBSD, etc can use those same tools. Telling a contributor "we recommend using VS Code with these extensions" in 2024 is pretty much the lowest barrier to entry you could ask for.
Whether your build tooling requires platform-specific tools is a completely different issue: this article and my comment on it isn't about that context. They're about commands that the article claims are essential to you, a person, in order to be a better developer. And to that statement my response is: you really don't. These can certainly be useful to know, but they're also completely optional.
(as the saying goes, Unix gives you enough rope to shoot yourself in the foot.)
Is there really anyone who is messing around on the Unix command line who needs to be told about cat, head, and ls?
(Admittedly this isn't something you're going to need to do unless you find yourself working with air-gapped systems, but .. I do)
tar -xaf foo.tar.gz
Will auto-un-gzip based on the extension. Also works with compressing:
tar -caf bar.tar.xz bar/