6 ms·
Learn Enough Command Line to Be Dangerous (Draft)
- eponeponepon 11y agoThe point in the introduction about people who work with developers needing to be familiar with the console is hugely important, in my opinion. It's the one bridge, short of someone having actual previous coding experience, that really makes my life easier at work. It also makes people feel, or so I observe, more confident and in control of their workstation.
- mhartl 11y agoIndeed, I hope that the three-tutorial sequence covering the command line, text editors, and Git will be a useful package for the works-with-developers crowd.
- gopher2 11y agoThis is great! I work on a team of "intended audience members" for this and have already shared it with some people. Is this the first of the 3 tutorials or do Git/Editors ones exist as well? (I know there are plenty of other git resources out there) Cheers!
- mhartl 11y agoGlad to hear it! Learn Enough™ Command Line to Be Dangerous is the first of eight planned prerequisites to the Rails Tutorial, the first three of which cover the command line, text editors, and Git. The text editor tutorial is currently in preparation, to be followed by Git, et al. See http://learnenough.com/ http://learnenough.com/ for more information.
- bittercynic 11y agoWhat do you have to do to get at the content?
- kazinator 11y agoMaybe whip up some curl commands in a command line, post-processed with sed and awk. I enabled JS from a couple of domains, then gave up and backbuttoned out.
- 101914 11y agoUse the command line to get the URLs for each chapter? Go to conqueringthecommandline.com/book Save the page source Insert the filename into the script below Alternatively, omit filename and pipe the source of the page to the script Works with BSD sed as well as GNU sed; first lesson: portability a=$(printf '\004') sed 's/s3_url/'"$a"'&/' \ |tr '\004' '\012' \ |exec sed ' s/\\u0026/\&/g; s/.*s3_url.:.//g; s/\".*//g; /https:.*Amz/!d; ' filename I do not recommend this "book". Look at the hoops they make readers jump through. Try grymoire.com; much better and no Javascript required
- mhartl 11y agoYou appear to be confusing two different documents. The OP refers to http://learnenough.com/command-line http://learnenough.com/command-line, not http://conqueringthecommandline.com/book http://conqueringthecommandline.com/book.
- deleted 11y ago[deleted]
- 101914 11y agoIndeed. My apologies. Instructions to get the URL to the Hartl draft are the same, except: Substitute "learnenough.com/command-line" for "conqueringthecommandline.com/book" Script will work just the same.
- sunnid 11y agoHere is the table of contents to make things a bit easier so you won't have to go through all the URLs: https://softcover.s3-us-west-2.amazonaws.com/8/unix_commands/html/frontmatter_fragment.html?X-Amz-Expires=604800\u0026X-Amz-Date=20150919T211612Z\u0026X-Amz-Algorithm=AWS4-HMAC-SHA256\u0026X-Amz-Credential=AKIAJMNNDDBSYVXVHGAA/20150919/us-west-2/s3/aws4_request\u0026X-Amz-SignedHeaders=host\u0026X-Amz-Signature=ef1cbb2076eb2746a73ea33bcd0b75636224f3c2e01d457d2c56a5e464ffff2a https://softcover.s3-us-west-2.amazonaws.com/8/unix_commands...
- erokar 11y agoI really wish developers today (in the 2000s, for Christ's sake) didn't have to deal with such a horrible UI. The Unix Hater's Hanbook says it well: "The original Unix solved a problem and solved it well, as did the Roman numeral system, the mercury treatment for syphilis, and carbon paper. And like those technologies, Unix, too, rightfully belongs to history. It was developed for a machine with little memory, tiny disks, no graphics, no networking, and no power." Bu since wee seem to be stuck with Unix, I guess we need any guidance we can get.
- liveoneggs 11y agodemonstrate your improvement
- seagreen 11y agohttps://en.wikipedia.org/wiki/Plan_9_from_Bell_Labs https://en.wikipedia.org/wiki/Plan_9_from_Bell_Labs https://en.wikipedia.org/wiki/Genera_%28operating_system%29 https://en.wikipedia.org/wiki/Genera_%28operating_system%29 Personally, I think that if 1% of the resources that have gone into various Unixes had gone into either of these systems, the outcome would have been far superior.
- vezzy-fnord 11y agoPlan 9 started as an off-shoot of Research Unix and in some ways it is the raw, unfiltered Unix ideal, along the way influenced from work done at PARC and ETH Zurich. By and large the GNU/Linux community seems to be drifting away from Unix as far as possible. Genera certainly sets a bar for a single-user workstation.
- el_benhameen 11y agoI enjoy Unix and the Unix philosophy, but I'm legitimately interested: what would a better system look like to you?
- seagreen 11y ago
- natch 11y agoNicely done! Feedback, since it's a draft: There's a lot of introductory verbiage at the beginning. I wonder if this could be condensed or put off in a sidebar. On OS X, for some languages at least, if the user has installed additional keyboard input languages, then Command-space may be taken over for switching input language, and thus the instructions for opening a terminal with Spotlight would not work. Looked through some of the explanations and things such as the walkthrough of Ctrl-C are very well done for true beginner level readers.
- mhartl 11y agoThanks for the feedback. The reason for the verbiage is that this is the first of eight planned prerequisite tutorials [1], so Learn Enough™ Command Line to Be Dangerous is setting the stage for all the others as well. The introduction to each future tutorial will be focused exclusively on the content of that one document. I'll definitely look at putting some of the intro into a sidebar, though; that might work well. Regarding Command-space, I've added a clarification regarding ways to start Spotlight. Thanks again for the helpful suggestions. [1]: http://learnenough.com/ http://learnenough.com/
- BWStearns 11y agoMy cmd + space is actually somehow bound to both, so to search I do: cmd + space ; esc ; cmd + space Every once in a while I debate uncolliding them, but for some reason I get a mild kick out of occasionally unexpectedly seeing cyrillic dump out on the command line.
- 11y ago
- BWStearns 11y agoWhat a great tutorial. This was definitely an underserved portion of the learning process. Also, learned `cd -` and I think my days will be ever so slightly but definitely better for it. Thanks for sharing! Also definitely go into why `rm -rf` is such a dangerous command, by that stage in the tutorial the reader has likely begun feeling confident experimenting but has yet to encounter anything really dangerous.
- digi_owl 11y agoThere are times i wish rm had a dry run kind of switch, where it would list out all the files that would be affected before asking for approval.
- deleted 11y ago[deleted]
- dcgoss 11y agoHave you ever considered that not everyone emerges from the womb with detailed knowledge of the command line? Obviously this isn't meant for seasoned veterans, but if you're learning/new and have no idea what you're doing this could be a big help.
- bdcravens 11y agoAs mhartl pointed out, it's really not designed for the typical HN reader.
- mhartl 11y agoWho is this book for if not for programmers? As noted in the introduction, it's aimed at complete beginners: [T]his tutorial is aimed at complete beginners, so it assumes no prerequisites other than general computer knowledge (how to launch an application, how to use a web browser, etc.). Among other things, it doesn’t assume you know how to use a text editor (or even what that is), and as far I as know Learn Enough™ Command Line to Be Dangerous is unique in this respect. Indeed, this tutorial doesn’t even assume you know what a command line is, so if you’re confused about the title, you’re still in the right place.
- atbattag 11y agoWhen introducing kill, don't use -9. Not a good way for a beginner to learn kill. Guess you weren't kidding with "Learn Enough Command Line to Be Dangerous". Understood that it's a draft. Coming together nicely.
- mhartl 11y agoCould you expand on this? In my experience, kill frequently fails without -9, so I basically always include it (and it's never bitten me). I'm open to suggestions, though, so if you have a recommendation for a better way I'd appreciate the feedback. (Feel free to shoot me an email at the address in my profile.)
- mmagin 11y agokill -9 is like rm -rf. Sometimes you need it, but it's the path of maximum destruction. In the case of kill, signal 9 (SIGKILL) is a signal that processes cannot trap, so they immediately end without any chance of cleanup or saving state. Unless you really don't care about data the process may have been working with, it's usually best to try a plain kill (sending SIGTERM) first.
- lloydde 11y agoFails? Frequently? In whet contexts? Was the process already suspended? The process might have been processing the SIGTERM and shutting down cleanly, but we are impatient so we -9, SIGKILL it, knowing that it can't process that signal and will be terminated (as long as its parent is alive). Or you are correct and there are many scenarios where it will be ignored. Oh, the developer is walking by and I mention the "hang" to him. He replies, "did you kill -3, SIGQUIT, to generate a core? No? Bye." Need the process to re-initialize, does the program have a SIGHUP handler? kill is more geneneral than the name implies, though I agree signaling is an intermediate topic.
- atbattag 11y agoAs already stated, a process cannot respond to KILL signal, not allowing it to cleanup after itself. In many cases this may be OK or irrelevant, but you should never use -9 as a first resort. -9 is a last resort. Ever kill -9 an unresponsive rails server process only to find that you have to manually rm the tmp server.pid file? That's because you used -9 ;).
- meeper16 11y agoWhat has the world come to where the command line is something foreign to a software developer? Throw me on an island with a few unprovisioned *inux boxes and I'm all set.
- JasperBall 11y agoA different type of world?
- meeper16 11y agoI agree. We're entering a world of Microsoft Bob for software engineers, architects, developers. I suppose there's more opportunity to invent and discover because of this. Some people eat McDonalds, I prefer my own garden from the ground up. I can actually invent new things that way.
- wildlogic 11y agoI prefer my own garden from the ground up, but I still eat McDonalds!
- mhartl 11y agoWhat has the world come to where the command line is something foreign to a software developer? What in the world are you talking about? The whole point of this tutorial is to teach command-line basics as a first step toward becoming a software developer. From the tutorial: Many programming tutorials either gloss over the command line or assume you already know it. But understanding the basics of the command line is absolutely essential to becoming a skilled developer. Indeed, if you look at the desktop of an experienced computer programmer, even on a system with a polished graphical user interface like Macintosh OS X, you are likely to find a large number of “terminal windows”, each containing a series of commands at a command line (Figure 1). Proficiency at the command line is also useful for anyone who needs to work with developers, such as product managers, project managers, and designers. Making this valuable skill accessible to as broad an audience as possible is the goal of Learn Enough™ Command Line to Be Dangerous.
- sciencesama 11y agoCommandline.fu is a good source too
- Roadgazer 11y agoI understand this thing is aimed to create super power perception within tech novice ppl when some command line is learned, but, seriously, this new fashion of claiming that if you wrote couple lines of code means you are software guru now, is absurd.
- 01Michael10 11y agoWho claimed this? You totally missed the point of these tutorials. It's "Learn Enough Command Line to Be Dangerous" NOT "Learn Everything About the Command Line to Be a Guru".
- SebKba 11y agoI really like the format and styling! It's broken up nicely with the images you added and the commands are kept to the really important ones. The summaries at the end of each chapter is great as takeaway. Maybe you could create a cheat sheet of the combination of summaries? I'm looking forward to the Git edition of this series.
- mhartl 11y agoMaybe you could create a cheat sheet of the combination of summaries? Cool, that's a great idea. It should be easy to extract all the relevant tables and put them into a single document. Thanks!
- pagade 11y agoUnder 'less' commands - can suggest 'g' instead of '1G'.
- mhartl 11y agoHeh, I've been using 1G for so long I didn't realize g works, too. I'll think about mentioning it. Of course, one advantage of 1G is that it generalizes to values of n other than 1.
- rav 11y agoWhy is 1,060 KB of JavaScript required to display this wonderful text page? Is there a way to read just the text without any interactive elements?
- mhartl 11y agoThe Learn Enough tutorials use the Softcover system (http://softcover.io/ http://softcover.io/), which stores the HTML on S3 and uses JavaScript to pull it in dynamically. The flexibility and convenience of Softcover come at the price of a little extra JavaScript—a price that, from my perspective, is well worth paying.
- vram22 11y agoFor people who would like to go further, and explore writing command line tools (instead of only using them), in C [1], for Linux [2], this post and the linked article in it, by me, may be of help: Developing a Linux command-line utility: http://jugad2.blogspot.in/2014/09/my-ibm-developerworks-article.html http://jugad2.blogspot.in/2014/09/my-ibm-developerworks-arti... [1] In C, but the utility development guidelines described in the article mostly apply to other languages like Python and Ruby too, since the main principles are the same. [2] It may compile and run on Mac OS X too, since it is a Unix, but I haven't tested it on that platform.