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.
If their comfort level is limited due to lack of experience, I tend to sandbox them somehow and then walk them through a couple examples of “danger” vs “ok, this definitely won’t be irreversibel if it’s wrong, but I think it will do what I want.”
A couple of my go tos are the obvious rm -rf / vs ./ and a sed with and without -i on some random text file.
That naturally segues to “here’s the man page, here’s how to use it and search it.”
That tends to give them some confidence that they won’t accidentally cause real damage, and make it seem like they aren’t just typing arcane magic spells, but actually understanding how to responsibly put the pieces together.
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.
I use Minecraft with my students to introduce them to command-line-like scripting. Especially the worldedit plugin is fantastic for this. It keeps things light and shows them the power of scripting, in an environment they are familiar and comfortable with. They are much more comfortable with using a terminal/cmd afterwards.
Fun little utilities: robotfindskitten, cowsay, ponysay, botsay, sl, aafire, bb, viewing videos in the terminal with “mpv, --vo=tct” and perhaps feedgame that comes with orbiton. Htop is also pretty colorful. Lazygit and mc too.
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.