Aliases are good… but yet be careful with them
Aliases are powerful instrument that really allow you to do lots of powerful things and simplify life a lot. But they should be used carefully, here are several reasons for it:
- Some things should be aliased at place where they belong to, for example, git aliases. Just because it will be easier for you and your shell completion to keep the context of command. It just make easier for you work with the command.
For example, it is much easier to understand “g p -f” (where “p” is git alias for “push” and “g” is shell alias for “git”) than “gpf”. Also, this approach is much more extensible, configurable and simple, because you make maximum use of instruments' power. In context of same example, it is easy to push without “--force” parameter. Just simply type “g p”, and that’s all.
- You can easily to override some system application by accident. For example, once I aliased “gcc” to “git commit --amend”. But there is Gnu C Compiler, which can be accessed via “gcc”. As it is the most used instruments for compiling software, I couldn’t compile several programs I was working with that time.
- Another one is that with more aliases, more time it will take for your <shell>rc file to start up. Then you will spend more time waiting for your shell to start up. Than all the productivity of your aliases will be totally killed by awful terminal start up time.
- The last thing is more about “purity” of environment. It is considered as “good” to have as pure as possible system.
Than there will be less probability that your specific setup will be broken.
And people will be able to help you if you have some problem (because they will likely be able to do something without any “magic” happening around.
Nevertheless, your aliases you listed in the article are pretty ok, some of them are really useful, for example, the fifth one, “Show my ip address”. Thanks much!
P.S. npm is pretty aliased tool as is. For example, “npm install --save express” could be shortened and written as “npm i -s express”. By the way, npm has it’s own aliases, like git and bash.