Skip Navigation

What helps people get comfortable on the command line?

Sometimes I talk to friends who need to use the command line, but are intimidated by it. I never really feel like I have good advice (I’ve been using the command line for too long), and so I asked some people on Mastodon:

if you just stopped being scared of the command line in the last year or three — what helped you?

This list is still a bit shorter than I would like, but I’m posting it in the hopes that I can collect some more answers. There obviously isn’t one single thing that works for everyone – different people take different paths.

I think there are three parts to getting comfortable: reducing risks, motivation and resources. I’ll start with risks, then a couple of motivations and then list some resources.

I'd add ImageMagick for image manipulation and conversion to the list. I use it to optimize jpg's which led me to learn more about bash scripting.

41 comments
  • Do everything on your command line.

    Why click and drag files when you can mv *.png

    Why use an IDE when you can setup vim (or space vim on neo vim) to load all the plugins your IDE would need, but only for the particular tasks that would leverage all those plugins (saving you overhead when you're not leveraging those plugins)

    Why use word when you can use pdflatex to turn your .tex files into .PDFs, with vim setup to trigger pdflatex on every post buffer write event, while zathura renders the PDF automatically

    Why manually start your code, when you can set it up to trigger automatically at start up or in response to other events

    The answer, of course, is because it's effort. The pay off is getting marginally better on a skill curve with an infinite ceiling. But the point being, anything your computer does, can be interacted with functions and variables / data structures, and can be automated with shell languages

  • I knew basic CLI commands (such as cd and ls) for a while, but did not do learn much more. Some things have helped me grow my skills:

    • Necessity: Some times I need to do something on a VM or container that does not have a graphical interface installed. Some utilities only have a command line interface and not a graphical client. My only option is to Google how to do it. The more I do it, the less I have to Google and the more focused my searches become (instead of searching for "How to do x", I search for "How to do x in utility").
    • Learning from others: For many tasks, I follow internal or external guides, which typically use CLI commands. Often I look at how my coworkers accomplish tasks and pay attention to what commands they use. Then, when I have time, I look up any new commands I saw and decide if they will be useful for me too. Lately, I have been doing code reviews that involve shell scripts. Those are especially nice, because I can take my time, going line by line, and understand what each command does.
    • Keep notes: Every time I find a command that I think I will need again, I copy it into a text file (and I have many such text files). It also makes it easier when I need to run the command with slightly different arguments (a different commit id or something), I can just edit the command in my editor (with searching and undo) and paste it in to my terminal with all the flags and arguments correct.
    • 2nd on the keep notes suggestion. I work on lots of unrelated projects, and each time I end up learning a bunch of new command line utilities, so I try to leave behind a text file describing some of the most useful commands I'd discovered that day. Usually helps me come back to a project and not be back at square one every time.

  • It's not exactly clear to me who is supposed to be more comfortable.

    Anyhow:

    • Avoid commands that require their own DSL. Most DSLs are ad hoc garbage, in particular when it comes to UX and UI design.
  • Eh, none of this is really addressing the fundamentals of getting comfortable figuring out how to do what you wanna do, which is what in my experience leads to people seeing command line use as magic incantations.

    Like, if you’re on windows you know how to figure out how to do what you wanna do, right click a file, look for entries in the context menu, look at the properties, open with, etc.

    This works because people fundamentally understand the metaphor behind the operating system.

    If you’re in bash and don’t know how to do what you wanna do you don’t need any of this fancy zoomer shit, just use “which”, “man”, whatever your package manager offers and the other commands that had big oriley books written about em.

    People need to develop the command line equivalent of the “click around and see if you learn anything” skills.

    E: I gave the linked article another read and it really is about setting up a production environment in the command line and not about getting people comfortable with the command line at all.

    Like, if someone needs to cut down a tree in their front yard they don’t need to know how to operate a felller-buncher, they need to know how to use an axe handle to judge where the tree will fall and what it will fall on.

  • Electroshock. I that is too "harsh" or "inhumane" then a cheat sheet.

    At the end of the day the command line is a tool that you are using to do something. If I have to google "how to commit file changes to bitbucket using the command line", I'm probably just going to use whatever GUI tool is available. Or I may do something really silly like manually copy the changes into bitbucket's web interface. If I had a cheat sheet easily available, then I would just look at that. The rest is just practice and repetition.

    Just throwing this out there. It really helps if everyone on the team is comfortable enough to ask for help. If you are a manager, it's your job to create this kind of environment. And if you see some newbie data analyst that just learned python and is intimidated by a bunch of software engineers copying a bunch of changes into bitbucket's web interface. Don't tell them that they are doing it wrong or they don't know what they are doing. Just say "hey, there is a much easier way to do that" and then show them. If a tool makes somebody's job easier then they will use it.

41 comments