I have an alias r='fc-s'
, and I find it very useful in some limited cases. To run the last command, just type r
and hit enter, and that's it. Of course, that itself is not very useful because up arrow does the same thing. But you can use r
to run the previous command with substitutions. Let's say your last command was a long command compiling some file:
$ gcc -c <file_name>.c <lots of options> -o <file_name>.o
Now you want to compile another file with the same options and have a corresponding .o
file:
$ r <file_name>=<new_file>
will do it. You don't have to use up arrow, navigate to the right places and then replace them each manually. This can be repeated multiple times, so you can do this next:
$ r <new_file>=<other_file>
Of course, for such a thing you have makefiles, but I hope I have shown that the alias is useful.
I haven't needed the use of this alias a lot, but there have been times that I have been glad that I have this alias!