TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Ask HN: What do you need to know to be good at the Unix Command Line?

17 pointsby mnemonicslothabout 1 year ago
Unix famously comes with a lot of documentation, but it&#x27;s still famously hard to learn. Why?<p>As a teacher and cognitive scientist, the reason is interesting: Unix documentation, starting with its man pages, is presented in a format that makes it easy for experts to look up details, not for beginners to learn concepts or build skills. O&#x27;Reilly, Sam&#x27;s, APress and others have built large businesses selling second-best solutions to this problem.<p>This is a teaching anti-pattern that emerges when domain experts -- <i>but teaching novices</i> -- try to write a curriculum from scratch. They don&#x27;t realize that teaching is a separate skill from the material to be taught, and that a great deal of effort is needed to break a domain down into right-sized, self-sufficient chunks for the reader to consume. Instead, they produce big volumes of unorganized knowledge (man pages) that reflects <i>their expert-level understanding</i>, that the reader tries to sift through and, as often as not, gives up on in frustration. Even when you pay experts to write beginner-friendly books, you get separate books on bash, awk, sed, grep, regexes, files, processes, packages and so on. These put the onus on the reader to remember all the details and put them all together into something useful.<p>Having dumped all this information on you, I always get the feeling that the gurus are patting you on the head and saying, &quot;Well, learning is hard. You have to work at it. Be sure you practice enough and you&#x27;ll figure it all out eventually.&quot; Learning is not supposed to be easy, and you do have to practice, but too often that attitude serves as an excuse to stop looking for better teaching methods.<p>So I&#x27;d like to propose one here.<p>The interactive piece takes place on the user&#x27;s machine. They clone a git repository that contains lots of text files that they can manipulate with complex commands, according to lessons and exercises delivered via a web app. The web app helps the user remember using a technique I call graduated spaced repetition, which extends the basic SuperMemo algorithm to test <i>concepts</i>, not just facts, with progressively more elaborate questions.<p>All of this should be relatively simple to write. The main differentiator will be good instructional design which -- sorry if I sound like a jerk here -- I have not seen much in evidence in the 20 years I&#x27;ve spent learning this material.<p>Which brings me to my questions for you:<p>1. I know a lot of people have already tried to do this. Can you point to any existing learning tools that have really knocked it out of the park?<p>2. What text processing tasks do you consider absolutely essential to Unix command line proficiency?<p>3. What kinds of text files (Natural language text, CSV, logfiles, etc) would it be useful to practice on to get there? Where can I find some?<p>If you want to talk about building the training set or the extensions I&#x27;ve made to the SuperMemo protocol, or if you just want to spitball ideas, you can email me at $MY_HN_USERNAME@gmail.com

9 comments

solardevabout 1 year ago
IMO: These days, it&#x27;s hard to see a reason for learning this stuff by rote memorization when ChatGPT is already so, so good at it. You just give it a sample few lines from your text file and tell it what you need the output as, and it&#x27;ll break down every command and parameter for you, whether that&#x27;s a complex regex or a bunch of piped commands.<p>Man pages in (in its training), results out, all expressed in natural language. Seems more useful than an old-school curriculum, TBH...
评论 #40056215 未加载
评论 #40048779 未加载
more_cornabout 1 year ago
Manipulating text files is probably not enough. This is what I usually teach:<p>1) learn the parts of the command including long and short versions of options(command, options arguments) 2) learn how to execute commands and troubleshoot (which, ls -al, chmod, etc) 3) learn to chain commands with the pipe (grep, sort, awk, sed, wc and grep -c, learn the common misuse of cat since most commands you’re passing to take a filename argument) 4) learn about history, reverse history search, history shortcuts like !! And !:1, tab completion<p>The way I do this is to have students set up a raspberry pi and ssh into it. There’s a lot of fiddling and troubleshooting involved and it builds good practice.<p>You should also probably teach command line tool access in vi for processing huge files visually e.g :%! grep
al_borlandabout 1 year ago
&gt;They clone a git repository<p>I think this is a bad starting point. To learn Unix, first learn git. Sure, it’s one command for them to type that can be given to them, but I know a lot of people who are scared of anything git related and it would create a barrier to entry, especially for those who have no other reason to know much about git (like every non-dev).<p>This also creates a chicken and egg situation. I need to clone a git repo using the command line to start using the command line. Without already knowing commands like ls, cd, and pwd, I may not clone it to the right place, or be able to find it once it’s cloned. I’ve seen this countless times, even from people working in the tech industry.<p>&gt; 1. I know a lot of people have already tried to do this. Can you point to any existing learning tools that have really knocked it out of the park?<p>vimtutor is decent, as a hands-on way to learn vim. Though, few people seem to have the patience to actually go through it. Learning the command line is self-selecting in a way. Those who has the willingness to use a lot of the current materials are the ones who will have the willingness to use it day to day.<p>Learning how to read the man pages, more than just the command to type, should be an early required part of learning, but it often skipped. There is a lot to be said for becoming good at using the reference material that will always be with you, and not having to hope someone wrote a blog post about the exact issue a person is having. Making something to help users learn that really well, will pay dividends.
sillystuffabout 1 year ago
&gt; 2. What text processing tasks do you consider absolutely essential to Unix command line proficiency?<p>Learn regular expressions (REs). Every text processing tool including decent editors uses REs. And, you will never have mastered any of them without having mastered REs first.
t-3about 1 year ago
<a href="http:&#x2F;&#x2F;man.openbsd.org&#x2F;sh" rel="nofollow">http:&#x2F;&#x2F;man.openbsd.org&#x2F;sh</a><p>That&#x27;s all you need to read to learn the <i>shell</i>. Learning about the commands requires actual hands-on work with a system, because the commands vary between systems and which ones you use depends on what you&#x27;re doing. A general &quot;how to be good at *nix command line&quot; class will always be boring rote memorization, because there aren&#x27;t really any concepts or skills to learn, just details.
xs83about 1 year ago
You need to use it as your primary OS and learn by doing.<p>Start on the basis that you shouldnt have to download something to do what you need, it all comes pre-installed and go from there.<p>Need to process some text files? Use awk &amp; sed etc Need to partition and format a drive? use fdisk, parted etc Need to encrypt a drive &#x2F; folder - use LUKS<p>Everything you need is on the system itself including the files to run tests on, the rest of it will come with normal usage.
hnthrowaway0328about 1 year ago
One extreme is to implement a simple shell with some Unix tools by yourself. I used to do that for ls and thus remembered many of its options -- but of course such knowledge does not retain well.
hulituabout 1 year ago
&gt; Ask HN: What do you need to know to be good at the Unix Command Line?<p>man.
gregjorabout 1 year ago
Unix seems hard to learn because it started as a tool for experts, people who already understood the underlying concepts and had experience with other operating systems. Someone coming at Unix without some understanding of the fundamentals will struggle with it.<p>Unix doesn&#x27;t refer (anymore) to a single operating system or collection of tools. You probably mean Linux, which comes in many flavors (distributions), or maybe to MacOS. No one company or organization makes Unix, and while the fundamentals and basic concepts hold across the Unix-derived operating systems the details -- things like command line arguments and directory structure -- can vary a great deal.<p>You conflate the core operating system with &quot;user space&quot; tools such as awk and sed, abstractions such as regular expressions, and vendor-specific things such as package management. We can lump those together and call them &quot;Unix&quot; but only in the same way we can refer to a generic &quot;car&quot; as a thing with an engine and four wheels.<p>I have taught several people how to use Unix&#x2F;Linux&#x2F;MacOS to some degree, to accomplish some specific tasks. I have seen them struggle with basic concepts such as directories and file organization, permissions, the whole idea of executable scripts, &quot;piping&quot; and redirecting input and output (&quot;everything is a file&quot; doesn&#x27;t mean much to most people). When it comes to processes, networking, inter-process communication, different kinds of text files (ASCII vs. Unixcode&#x2F;UTF-8, for example), etc. most people just get lost or lose interest because they don&#x27;t have any mental categories or real-world analogies to connect to. Anyone approaching the problem of &quot;learning Unix&quot; today probably has experience using computers, but they really have experience using graphical user interfaces that hide the details and application programs such as Word or GMail that offer task-oriented user interfaces with none of the underlying fundamentals exposed. Learning the concepts that underly Unix, or any operating system, requires going down some rabbit holes to understand things like text file, directories, processes, and so on. Few people will have the patience and motivation to do that work, to read technical books on operating system fundamentals and design.<p>If I showed someone how to use grep to search text files for a string they might get that after a while, but they probably don&#x27;t really understand text files or regular expressions -- they have just memorized the steps to complete a specific task. If I then tried to explain how to search a CSV or XML file that new information might not connect, and the person has simply learned how to do two or three very specific tasks without gaining much fundamental expertise. That&#x27;s like someone memorizing a few recipes from a cookbook but not actually learning much about ingredients or cooking.<p>What you propose seems like trying to learn top-down, by practicing specific tasks such as text processing (largely incidental to the operating system). Some people can learn that way -- working through enough tasks with repetition will let them deduce the abstractions and encourage them to explore on their own. Most people will fail because years of schooling have discouraged that kind of thinking, making them goal-oriented and focused on completing a specific task by memorizing specific steps rather than actually learning. And many people don&#x27;t have the motivation and desire to learn how regular expressions work, or what a &quot;process&quot; means in the context of Unix.<p>No amount of instructional design will help everyone learn a complex topic. Analogously, you can&#x27;t get through medical school by practicing a few procedures over and over. You have to learn some biology and anatomy so the many things you have to study and remember make sense and hang together.<p>There&#x27;s no way I know of to even have this discussion without coming across as as elitist. I learned Unix (and C) from the Bell Labs Technical Journal articles published back in the &#x27;70s because I had an obsessive desire to do that, and the spare time and energy of a teenage boy bored with high school. I put a lot of time in, sought out mentors, practiced, explored, studied. Everyone I know who has mastered a complex skill or set of tools tells the same story. My experience was more like learning a language by immersion than with flashcards presented in an app. I don&#x27;t think most people incapable of learning Unix or any other technical skill, but I do think few people have the motivation, time, and persistence to do it, and instead want some easy way to get information spoon-fed to them, a process they already understand as &quot;learning&quot; because schools mostly work that way.<p>Good luck with your project.