
Learn Enough Command Line to Be Dangerous (Draft) - hkailahi
http://www.learnenough.com/command-line
======
atbattag
When 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
Could 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.)

~~~
atbattag
As 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 ;).

~~~
mhartl
So would it be reasonable to recommend _kill $pid_ as a first step and _kill
-9 $pid_ if that doesn't work? Bear in mind that this is a tutorial for
beginners, so things like _kill -15 $pid || kill -2 $pid || kill -1 $pid ||
kill -9 $pid_ (as another commenter suggested) aren't appropriate, but I feel
like _kill_ is too important a command to leave out completely.

~~~
atbattag
Suggesting kill first before kill -9 seems like a good idea. Like you said
kill is an important tool. Like you said this is for beginners so its up to
you how much more detail to go into with the command.

~~~
mhartl
Great, thanks for the suggestions.

------
natch
Nicely 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
Thanks 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/)

~~~
hliyan
I too, agree with condensing the introductory paragraphs. Great work!

~~~
mhartl
Thanks!

------
BWStearns
What 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
There 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.

------
eponeponepon
The 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
Indeed, 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
This 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
Glad 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.

------
SebKba
I 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
_Maybe 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!

------
vram22
For 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-
arti...](http://jugad2.blogspot.in/2014/09/my-ibm-developerworks-article.html)

[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.

------
pagade
Under 'less' commands - can suggest 'g' instead of '1G'.

~~~
mhartl
Heh, 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_.

------
erokar
I 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.

~~~
el_benhameen
I enjoy Unix and the Unix philosophy, but I'm legitimately interested: what
would a better system look like to you?

~~~
z1mm32m4n
There's the rather entertaining talk "A Whole New World" by Gary
Bernhardt1[1]. The first time I saw it I was quite disappointed such a system
didn't exist.

[1]: [https://www.destroyallsoftware.com/talks/a-whole-new-
world](https://www.destroyallsoftware.com/talks/a-whole-new-world)

------
rav
Why 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
The 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.

------
meeper16
What 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
A different type of world?

~~~
meeper16
I 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
I prefer my own garden from the ground up, but I still eat McDonalds!

------
Roadgazer
I 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
Who 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".

------
bittercynic
What do you have to do to get at the content?

~~~
sunnid
Here 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...](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)

~~~
mhartl
This is the ToC for a different book.

------
sciencesama
Commandline.fu is a good source too

