Post pobrano z: A Reasonable Approach for Getting Comfortable With Command Line
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
- 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!
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.