1

Suppose I wanted to kill firefox , I just write pidof fi(press tab)refox (appears on its own) , then I write ' kill 'id given by pidof' ' on terminal.

I know that I can write 'kill `pidof firefox` ' but the autocomplete does not work . So I wanted a command like mykill firefox (on which tab completion also work) which on the background runs 'kill `pidof firefox` '

mykill process name (with tab completion) -> kill `pidof process name`

aabhas
  • 193
  • 1
  • 6

1 Answers1

3

Your best bet would to just use the pkill command instead. It can be found in the procps package. You use it like so:

pkill fir<tab>
pkill firefox

To get completion for nested commands, your shell (bash) needs to be smart and enable autocompletion in those scenarios. Unforunately, it looks like it does not. I believe the alternative shell, fish, does.

CameronNemo
  • 1,675