Considering how much the command line is an integral part of the developer’s workflow, it should not be thought overly difficult or tedious to learn.
At one time I avoided it myself, but one day began teaching myself ways to make the difficult as easy as it should be. I got over the hurdle, and you can too. It was worth investing my time to increase my command line comfort-level, and I am going to share a few tips and resources that I found helpful in this post.
The intended reader is the type who typically avoids the command line, or perhaps uses it occasionally but not as a regular or essential tool.
Tip #1: Maintain a Pragmatic Mindset
The way to get more comfortable with the command line is this: practice. You practice, and you get better. There is no secret trick to this; study and repetition of skills will turn into understanding and mastery. There is no use in the mindset that you cannot do this; it will only keep you from your goal. You may as well discard such thoughts and get down to it.
Tip #2: Keep a Cheat sheet
Don’t be afraid to keep a cheat sheet. I find that a thin, spiral-bound notebook kept next to my keyboard is perfect; writing the command down helps commit it to memory; having it in a place where I can refer to it while I am typing is convenient to the process. Do not permit yourself merely to copy and paste; you will not learn this way. Until you know the command, make yourself type it out.
Tip #3: Peruse languages outside of the one(s) you normally use
- Spend time looking at commands in various languages, looking at the commands even if you don’t immediately absorb, use, or remember them. It is worth it to invest a bit of time regularly, looking at these commands; patterns will eventually emerge. Some of them may even come back to you at an unexpected time and give you an extra eureka moment!
- Skimming through books with lots of CLI commands can prove interestingly useful for recognizing patterns in commands. I even take this one step further by getting my favorites spiral-bound. I am a big fan of spiral binding; a place like FedEx offers coil binding services at a surprisingly low cost.
Tip #4: Practice… safely
When I am advising someone who is new to contributing to open source, they are inevitably a bit nervous about it. I think this is perfectly natural if only to comfort myself that my own nervousness about it was perfectly natural. A good way to practice, though, is to set up your own repository for a project and regularly commit to it. Simply using common Git commands in a terminal window to commit inconsequential changes to a project of your own, will establish the “muscle memory” so that when it does come time to actually commit code of consequence, you won’t be held back by still being nervous about the commands themselves.
These are the commands I have noticed most common to use in the practical day-to-day of development. It’s perfectly acceptable to expect yourself to learn these and to be able to do any of them without a second thought. Do not use a GUI tool (they make weird merge choices). Learn how to write these commands yourself.
- Check status
- Create a new branch and switch to it
- Add files
- Add all the changes
- Just add one of the changes
- Commit
- Push to a remote branch
- Get a list of your branches
- Checkout a branch
- Delete a branch
- Delete a branch even if there are changes
- Fetch and merge the changes to a branch
Syncing a fork took longer to learn- I don’t often spend my work hours writing code for a repository that I don’t have access to. While contributing to open source software, however, I had to learn how to do this. The GitHub article about the topic is sufficient; even now I still have it bookmarked.
Tip #5: Level Up!
I really enjoy using Digital Ocean to level up my skills. Their step-by-step guides are really useful, and for $5 USD per month, “Droplets” are a cost-effective way to do so.
Here’s a suggested self-learning path (which, feel free to choose your own adventure! There are over 1700 tutorials in the Digital Ocean community):
- Create a Droplet with Ghost pre-installed. There is a little command line work to finalize the installation, which makes it a good candidate. It’s not completely done for you but there’s not so much to do that it’s overwhelming. There’s even an excellent tutorial already written by Melissa Anderson.
- Set up a GitHub repo to work on a little theming for Ghost, making small changes and practice your command line work.
It would be remiss of me to write any guide without mentioning Ember, as the ember-cli is undoubtedly one of the strongest there is. Feel free to head over to the docs and read that list!
Conclusion
There may be some that find this brief guide too simplistic. However, as famously said by S. Thompson in Calculus Made Easy- “What one fool can do, other fools can do also.” Don’t let anyone else make you think that using the command line is horribly difficult, or that they are a genius because they can. With practice, you will be able to do it, and it will soon be a simple thing.
Undoubtedly command line is one the most powerful tools for developer and his(er) best friend. I would recommend Steve Parker’s book – Shell Scripting Tutorial. This is a great tutorial for shell command line for beginners. I recommended that book to all junior developers whom mentor I was.
Heuuuu, I must have totally missed the point here. But what are you actually trying to address?
People just use the command line for what they need to do period.
For instance, I only know three command for the Mongo DB command line interface while I know nearly all (>95%) of the Asterisk PBX CLI, tons of Mac and Linux command line tricks. I used to know 100% of window command line individual commands because I went through them one by one, and I used to teach it.
As you can see, it’s about which command line and what you need to do with it. Don’t use to much ceremonies. It’s just a command line after all. And more of then keep being created constantly.
If your needs require logging several hours of command line interactions a week, then your brain will naturally help you optimize your workflow. That is if you are smart and flexible about improving your workflow.
Additionally, you might consider using a shell called “Oh My Zsh” available at https://github.com/robbyrussell/oh-my-zsh … It will greatly improve your command line experience.
Oh, and for git, whenever you can, please leave the command for tasks that really do need the command line. Use SourceTree instead. You will be more productive IMHO.
Cheers
A big help for me was finding ways to avoid vim.(try again after you’ve learned the rest)
1. Setup nano as default terminal editor(you can also use external editors)
2. For commits use -m for short commit messages(most of the time people won’t read beyond the short anyway)
Apart from the listed git commands there are plenty of other very useful things you can do from the command line that you will miss out on when stuck on a gui.
Most notably ssh to do anything you want on the server. There is a ton of other things to list here but that can be saved for a more in depth article.
Instead of paying for DigitalOcean, you could sign up for a free account on https://tilde.town and ssh into the server. You’d have to use the command line exclusively in such an environment.