Tutorial hero
Lesson icon

Terminal Commands to Improve Efficiency

Originally published July 21, 2022 Time 3 mins

Thought I would throw something a little different out there this week - feel free to let me know if you would like to see these tips focus on Angular specifically, or if you also like general workflow stuff.

My tip for this week is to try to learn how to use bash/zsh and the terminal more effectively as part of your workflow - it can be insanely powerful in certain situations.

To give you a specific example of something that might actually come up in your Angular workflow, here is something that I had to do this week.

I had a pack of 30 png images that were all 2500x2500px. I needed to resize all of those to be 1000x1000px and 200x200px. To do that in image editing software I would probably need to dedicate most of an afternoon to getting it done.

But, with a little terminal magic, the job was done in minutes. This is just one particularly useful utility, but you can install imagemagik with brew (I install just about everything with brew).

This allowed me to use convert in the follow command:

convert in command

This instantly resized every single file. I accidentally messed this up the first time and ended up creating a bunch of separate files, each with - resized appended to the end. I could just go through and manually delete all of those, or…

instantly resize in command

Just do it instantly with the command above. That wasn’t even the end of this saga. The file names were also not quite in the format I wanted. Again, rather than manually renaming every single one, we can just do it all at once with a single command:

renaming with single command

This one will replace all upper-case characters with lower-case characters for every file in the current directory.

I am not even close to being competent with this stuff, there is a small set of commands I use frequently that I am comfortable with, but for stuff like the above I usually just Google it.

I am aiming to get a lot better at this though. It’s one of those things that pays off a lot more in boosted productivity once you are comfortable with the commands.

So, perhaps you want to join me in restricting yourself to performing operations on your computer using the terminal instead of the GUI wherever possible (even if it slows you down in the beginning).

To challenge myself, whenever I am in a situation where I would use the Finder GUI to perform some operation - like move, delete, or rename files - I am going to use the terminal exclusively instead.

Learn to build modern Angular apps with my course