DEV Community

Discussion on: The case against aliases

Collapse
 
yucer profile image
yucer • Edited

Actually, I did start using them to avoid remembering some Linux commands that did require a lot of parameters and that I had to use seldom. For example: removing my old kernels to free up boot space. I did note that the linux community usually implement new commands or apps for those cases.

With the time, I did start to use them in the commands that I have to type frequently.

Later, I have grouped many of them, and automated all the development task that I do on a daily basis:

  • pull the upstream changes for all my repositories
  • rebase my local branches
  • calling commands from my docker containers
  • listing my local development databases
  • taking the snapshopt of one database in the current state (that allows to reproduce the error)
  • restoring the database to the snapshot state

... and many more

The generated aliases are loaded by my .bash_aliases and their names sometimes are dynamically build according to some parameters (e.g.: the name of the active containers that have the programs they call). With a selected naming convention (with '_') the auto-completion avoids me to type a lot.

At the end, I have use metadata from the different projects that we have, and used a template system to generate the development environment with all the alias prepared.

Some of my workmates use it, they replicate the dev configuration with just few commands, even in new workstations. They also give me feed back, and I try to improve it. I encourage them to improve it also.

I like it because the scripts also installs all the dependencies or generate the docker-compose.yml with all the needed stuff.

Many of my workmates don't like it, because they think they will forget how to use the original commands. I am also afraid of that :-D

But Actually, as soon as possible I will try the dodo commands because I think it seems to be the correct solution for that.

Collapse
 
moopet profile image
Ben Sinclair

I have a few aliases and one- or two-line scripts that I use for repetitive tasks every day, but the way I most often work is to group them together in one line, for instance to pull my config files, I run:

(cd ~/.dotfiles && git checkout master && git pull origin master && ./install.sh)

since it's in a subshell (the parentheses) it doesn't leave me in a different directory when it's finished and since it uses && throughout it doesn't do anything unless the previous command succeeded. I call this up by doing <ctrl-r>dotf<cr> and rely on it being in my shell history rather than making it an alias.