How do you create a bash alias for a command with flags? For example, if I run ls -l
, I want that to alias to ls -a
.
This doesn't work: alias "ls -l"="ls -a"
Another example: If I type reboot now
, I want that to simply run reboot
.
Would bash functions be useful here?
EDIT: Sorry for the silly ls -l
example. This is what I really want: if you executed reboot now
, I want it to actually execute reboot
. This is why.
ls -l
if you wantls -a
? – jw013 Apr 11 '14 at 20:33reboot now
takes the machine down for maintenance, which is bad if you're SSHed into a remote VM and can't manually reboot it. I wanted to intercept allreboot now
commands and change them toreboot
. – Kevin Boos Apr 12 '14 at 00:46