johnnydecimal@hachyderm.io
johnnydecimal@hachyderm.io

šŸš€ LAUNCHING A THING TODAY šŸš€

My friend @ellane and I are pleased to launch a new mini-course:

šŸ§‘ā€šŸ’» Ellane learns the command line šŸ§‘ā€šŸ’»

She mentioned this to me a while ago, so we're going to do it live on Mastodon. Here, in this thread. We're thinking of it like a correspondence course.

You can't fit that much in a post, and formatting here isn't great, so the full posts will be on our mini blog at:

commandline.johnnydecimal.com.

We'd love you to follow along.

#LearnCLI

|
Embed
Progress spinner
johnnydecimal@hachyderm.io
johnnydecimal@hachyderm.io

01. Introduction & goals

On Mastodon, @ellane mentioned that she'd like to 'learn the command line'. What she told Johnny was that she wants to:

- understand what the command line IS
- learn how not to stuff up your machine
- learn what language it speaks
- understand what commands DO, where things go
- what's Homebrew, and why use it and what does it do, and how does it do it?

#LearnCLI

commandline.johnnydecimal.com/

|
Embed
Progress spinner
johnnydecimal@hachyderm.io
johnnydecimal@hachyderm.io

02. What is the command line?

A very high-level introduction to the command line. What even is it? Why would we use it?

You can click a button because some designer in Seattle designed the program to have a button.

But what if you want more granular control? What if there isn't a button for the thing you want to do?

Then you crack open the command line.

Over to you, @ellane.

#LearnCLI

commandline.johnnydecimal.com/

|
Embed
Progress spinner
claudinec@aus.social
claudinec@aus.social

@johnnydecimal @ellane I'm really interested to see how this goes! As someone who's lived in the command line for 30 years 😮 I have no idea how I would teach/introduce these concepts to a newbie.

|
Embed
Progress spinner
johnnydecimal@hachyderm.io
johnnydecimal@hachyderm.io

@claudinec @ellane :-) Wish us luck! I can't wait.

|
Embed
Progress spinner
ellane@pkm.social
ellane@pkm.social

@johnnydecimal Thanks, Johnny, this is outrageously exciting to my aspiring-geeky heart!

So I've done my assignment re- layers of abstraction. Makes perfect sense.

Just like my car's ignition button, I'm aware there's an organised, predictable series of events that take place once the button is pushed. Each of those events relies on those that came before it (pistons, oil, petrol, etc), but I don't have to think of any of that when I'm buckling up.

Computers be no different!

|
Embed
Progress spinner
johnnydecimal@hachyderm.io
johnnydecimal@hachyderm.io

@ellane Oh good analogy! That's going to be helpful.

Learning 'the command line' is like learning how to drive. But before we can drive, we need a vehicle.

Let me show you around your new car.

#LearnCLI

commandline.johnnydecimal.com/

|
Embed
Progress spinner
canion@social.lol
canion@social.lol

@johnnydecimal @ellane I know basics. I’ve tried to become a command line pro a few times, most notably through Bart and Allison’s ā€˜Taming the Terminal’ podcast series. But it has never stuck. I’m going to try again through this series!

|
Embed
Progress spinner
johnnydecimal@hachyderm.io
johnnydecimal@hachyderm.io

@canion @ellane Do it! The more the merrier; you'll catch my errors! :-)

|
Embed
Progress spinner
xxxx
xxxx

@ellane My thinking is that this would require you to take your hands off the keyboard, which, being keyboard-first, is one of the major benefits/appeals to working in the CLI?

|
Embed
Progress spinner
death.au@monrepos.casa
death.au@monrepos.casa

@ellane
My theory was just that it was a GUI (Graphical User Interface) element. Part of the Terminal app, but not actually part of the command line.

I didn't even think about interrupting a running process šŸ˜†
@johnnydecimal

|
Embed
Progress spinner
death.au@monrepos.casa
death.au@monrepos.casa

@johnnydecimal
Whoops, didn’t see the reply from @xxxx which basically said the same thing šŸ˜…
@ellane

|
Embed
Progress spinner
theTangentSpace
theTangentSpace

@ellane okay this is a fun thread, I’m here for this…

I don’t know quite what would cause the prompt to not reappear after a command. It’s possible the command was actually still running. There is a way to terminate a running command and thus return to the prompt but I will leave that to your tutor!

|
Embed
Progress spinner
johnnydecimal@hachyderm.io
johnnydecimal@hachyderm.io

@death.au @xxxx @ellane I didn’t see that, can you ping me a link?

|
Embed
Progress spinner
death.au@monrepos.casa
death.au@monrepos.casa

@johnnydecimal
micro.blog/xxxx/38517471
I actually had to go to Ellane’s profile on pkm.social (in a browser) to see it. I only looked because she replied.
Ah, the perils of federation…
@xxxx @ellane

|
Embed
Progress spinner
johnnydecimal@hachyderm.io
johnnydecimal@hachyderm.io

@ellane Hmm no, this is not normal.

Here's a little video. I type out `printenv`, hit return, see the result, hit return a few times, do it again. This is what should happen.

You're saying after your first screen of results the window becomes unresponsive?

Try typing vs. pasting, though that shouldn't matter.

share.cleanshot.com/kR2SZnj9

|
Embed
Progress spinner
johnnydecimal@hachyderm.io
johnnydecimal@hachyderm.io

@ellane Hmm okay let's just keep an eye on that. If it happens again, let me know.

Preparing my response as we speak! Should be there tomorrow.

|
Embed
Progress spinner
johnnydecimal@hachyderm.io
johnnydecimal@hachyderm.io

@ellane I had no idea what `view` did, by the way. Had to type it to see, at which point I realised it was a synonym for `vim`.

You learn something every day…

And you did the right thing hitting the red button aka the ejector seat. šŸ‘

|
Embed
Progress spinner
theTangentSpace
theTangentSpace

@ellane You have two options to deal with this. You can wrap the file path in quotation marks, which says ā€œtreat this as one argumentā€, or you can precede the space with a \ which says ā€œdon’t treat this space like break in the list of arguments, treat it as a literal space within the current argumentā€. What if your argument needs to include a real backslash? Then use \\ - the first backslash says the next backslash should be treated as a real backslash

But yes, you have stumbled on why heavy CLI users prefer underscores or hyphens to spaces

|
Embed
Progress spinner
theTangentSpace
theTangentSpace

@ellane note this is similar to markdown, where \* would give you a literal * instead of beginning an italic block

|
Embed
Progress spinner
death.au@monrepos.casa
death.au@monrepos.casa

@ellane
My trick is usually to type the first few letters then press the Tab key. It’s a handy shortcut most of the time to fill in long file or folder names, but in my experience it also handles the escaping for you as well.
@johnnydecimal

|
Embed
Progress spinner
theTangentSpace
theTangentSpace

@johnnydecimal btw love the traffic lights idea!

|
Embed
Progress spinner
death.au@monrepos.casa
death.au@monrepos.casa

@johnnydecimal
šŸ™‡ Forgive me for skipping ahead, Sensei. Sumimasen.
@ellane

|
Embed
Progress spinner
johnnydecimal@hachyderm.io
johnnydecimal@hachyderm.io

@ellane Look at this one more closely!

It should be `this\that` — the same backslash that you use for the escape character.

The puzzle is: how do you include the escape character in an argument _if it’s the escape character?_

|
Embed
Progress spinner
johnnydecimal@hachyderm.io
johnnydecimal@hachyderm.io

@death.au @hyde I should apologise and make it clear that I value feedback on this little endeavour.

If I’m not clear, or if I’m wrong — which will for sure happen — please call it out. Corrections will be made.

And I’m sure @ellane won’t go jumping ahead anyways.

😊

|
Embed
Progress spinner
hyde@lazybear.social
hyde@lazybear.social

@johnnydecimal No worries at all :)

And @ellane good luck with the CLI :)

Since I learnt it, I cant live without it.

|
Embed
Progress spinner
ConLuegering@nrw.social
ConLuegering@nrw.social

@ellane @johnnydecimal Hi both, just wanted to say thank you for this open and transparent communication about this learning experience!

I work in IT for some time and its not only a great reminder on how things work but also how many things are logical and others are ambiguous and sometimes confusing. šŸ™šŸ˜Œ

|
Embed
Progress spinner
In reply to
theTangentSpace
theTangentSpace

@ellane I expect your tutor will explain the confusing column soon enough, as it is good to know

|
Embed
Progress spinner
hyde@lazybear.social
hyde@lazybear.social

@ellane @johnnydecimal jut m'y two cents, when you do :

$ cd a\ dir\ with\ spaces

you can also use double quotes:

$ cd "a dir[tab]

And it will expand it to ;

$ cd "a dir with spaces"

|
Embed
Progress spinner
ConLuegering@nrw.social
ConLuegering@nrw.social

@ellane I have a question, which is slightly off-topic:

It looks like you have been less technical person in the past? If yes: How do you look on IT and apps, now that you took the red pill and left the matrix?

Do you think that "apps should just do their magic" or that this will help you achieve more? Do you believe that programming or IT Stuff is much more different that you thought and now want to unlearn about the truth?

Im just curious on your perception. 😌

|
Embed
Progress spinner
ConLuegering@nrw.social
ConLuegering@nrw.social

@ellane Thanks for your reply, I fully agree that it will take some more time to fully identify the impact of this exercise.

Needed to ask it early on, it might sit in the back your head so you can tell me closer to the end. šŸ˜‰šŸ™

(I started programming as a hobby again after 12 years and I see for myself how the different the world is or how rusty I have become? šŸ˜¬šŸ˜…

|
Embed
Progress spinner
johnnydecimal@hachyderm.io
johnnydecimal@hachyderm.io

@ellane Not at all! This is a whole other world here.

In the years running up to 2018 I tried and stalled and tried and failed to start learning some sort of programming language. Started one, stopped. Changed my mind. Started another.

So many times.

The one thing that finally got me was a JavaScript course, sadly now gone*, by a Google engineer. You should have seen how slowly he went.

Pain. Stakingly. Slowly. Like proper baby-steps slowly.

*It was free and now it’s $300/month.

1/2

|
Embed
Progress spinner
johnnydecimal@hachyderm.io
johnnydecimal@hachyderm.io

@ellane And that’s what I needed. That was the ah-ha moment.

Now I can do JavaScript, to an okay standard. Nowhere near many people, but good enough for what I need to do.

I still lean on the web. But because I understand the fundamentals, what I find myself needing is the pointer.

I’m in a dark room and you just need to put my hand on the switch. Then I can do the rest myself.

That’s what we’re going for here.

Fundamentals. Deep understanding.

Slowly. Until the light comes on.

2/2

|
Embed
Progress spinner
johnnydecimal@hachyderm.io
johnnydecimal@hachyderm.io

@ellane *Also*, it’s my job as the teacher to notice and adapt, but that can be hard as we’re just doing this by text.

So if at any point you think we’re going too quickly, please say so.

If there’s a concept that needs to be reinforced, re-explained, whatever: tell me.

|
Embed
Progress spinner
johnnydecimal@hachyderm.io
johnnydecimal@hachyderm.io

@ellane I just realised something! You have access to Learn Excel with Lucy.

Re-watch ā€˜Functions & Formulas’, and in pt. 2 pay close attention to the TEXTJOIN function.

_Syntactically_ it’s totally different to the CLI.

_Conceptually_ it’s **identical**.

- What’s the command?
- Does it have flags?
- Does it have options?
- Does it take arguments?

This is the thing about computers, and languages: once you internalise the _idea_, the rest is just translation.

4/5

|
Embed
Progress spinner
johnnydecimal@hachyderm.io
johnnydecimal@hachyderm.io

@ellane So the job is to train your brain to think in this really un-human way.

You’re becoming a programmer. The CLI is just a computer to be programmed.

Excel or the CLI. It doesn’t matter.

(For anyone following along, I’ll make that lesson free in the next couple of days and edit this post with a link.)

5/5

|
Embed
Progress spinner
johnnydecimal@hachyderm.io
johnnydecimal@hachyderm.io

@ellane Haven’t forgotten (or got bored of) this! Just had JD work to catch up on, sorry.

|
Embed
Progress spinner
johnnydecimal@hachyderm.io
johnnydecimal@hachyderm.io

@ellane Great. Yeah I was going to write a short summary post to reinforce what’s important to focus on and what’s not. I’ll do it here.

Important:
- The basic <command> <flags/options> <argument> idea.
- This is such a massive leap from clicking a mouse.
- We’ll do a LOT more of this over time.
- Viewing a document; getting around inside there.

Not important:
- Any of the specific flags or arguments to any particular command.
- None of the contents of the man pages! Scary nonsense.

|
Embed
Progress spinner
johnnydecimal@hachyderm.io
johnnydecimal@hachyderm.io

@ellane Let me know when you’d like to move on! No rush.

|
Embed
Progress spinner
johnnydecimal@hachyderm.io
johnnydecimal@hachyderm.io

@ellane Sorry sorry, haven't forgotten! Been a busy week, we've had people through and a bunch of other stuff going on.

|
Embed
Progress spinner
johnnydecimal@hachyderm.io
johnnydecimal@hachyderm.io

@ellane You can use whatever you like to edit them. And just dive down to the CLI as required.

But still, I think this is a valuable exercise. So have a play with pico, create a few files, edit a few files, and let me know how you get on.

Next, we’re going to go straight for the hledger installation page. 😬

4/4

#LearnCLI

|
Embed
Progress spinner
claudinec@aus.social
claudinec@aus.social

@ellane @johnnydecimal I am genuinely impressed! Welcome to the land of #Vim!

|
Embed
Progress spinner
hyde@lazybear.social
hyde@lazybear.social

@johnnydecimal @ellane maybe vimtutor can do it too !

Just type in your terminal :

$ vimtutor

|
Embed
Progress spinner
johnnydecimal@hachyderm.io
johnnydecimal@hachyderm.io

@ellane Little CLI hint: `history` shows you stuff you've previously typed.

If you want to repeat one of them, `!xx`, where xx is the number before the command, will do that.

Hitting the up-arrow repeatedly will also call back previous commands. There's a nice way to improve this that I'll tell you about later.

|
Embed
Progress spinner
natedunnmi@me.dm
natedunnmi@me.dm

@ellane @johnnydecimal Reading back through this and the emphasis on *precision* regarding case in the command line, I wondered what you thought about the "regional" spellings, such as "color" vs. "colour". Do both work? Does it bother you if one is preferred over the other? šŸ™‚

|
Embed
Progress spinner
natedunnmi@me.dm
natedunnmi@me.dm

OK, here @ellane asks about Control-E vs Control-E, and @johnnydecimal settles on the side of "not case sensitive."

But in the previous lesson, "Less Is More," in learning how to navigate a text file with search, "To find the next instance of the same search, hit `n`. The previous, `N`."

Isn't that an example of case sensitivity? Or is that a rare exception? Seems akin to "`tab` to move forward, `shift-Tab` to move backward" in many forms... šŸ¤”

|
Embed
Progress spinner
natedunnmi@me.dm
natedunnmi@me.dm

@ellane @johnnydecimal Was this the "end"? I've tried following the threads here on Mastodon, and I've reached what appears to be the last blog post, "Install some packages"... commandline.johnnydecimal.com/

|
Embed
Progress spinner
johnnydecimal@hachyderm.io
johnnydecimal@hachyderm.io

@ellane @natedunnmi Feels like a default that the community has settled on over the years.

Control-[CHARACTER] = not case sensitive, i.e. Ctrl-n doesn't do a different thing to Ctrl-N. Therefore, pick a default, which is to express it as a captial. Maybe that's just clearer?

Whereas 'n' to go forward vs. ā€˜N' to to back, they're two different commands.

'n' without shift does one thing. 'n' with shift, that is to say ’N’, _does something different_.

Lots of this is just historical decisions…

|
Embed
Progress spinner
johnnydecimal@hachyderm.io
johnnydecimal@hachyderm.io

@ellane @natedunnmi Also note how Mac + Windows is explicit about 'Shift'.

Ctrl+E on a Mac, means ā€˜control and the E key’.

You want a shift in there, you have to say it. 'Ctrl-Shift-E’.

Oh yeah, and look at your menus! Copy = ⌘C. But you don't have to press Shift to get a capital C.

Paste and match style = āŒ„ā‡§āŒ˜V. Needs a Shift, so the Shift is explicit.

|
Embed
Progress spinner