1

I was using fish-shell when reading about kill command. The output of kill -l command for fish is

HUP INT QUIT ILL TRAP ABRT IOT BUS FPE KILL USR1 SEGV USR2 PIPE ALRM .... 

When invoking same command in bash I had

 1) SIGHUP 2) SIGINT 3) SIGQUIT 4) SIGILL 5) SIGTRAP .... 

I checked kill with whereis, and there is valid path to program /usr/bin/kill. I also checked man bash for kill, and didn't find anything connected to kill itself :(, so it's not bash builtin. I also tried kill -l on tcsh and output was once more different. This is not very important problem for me, but I really curious why does it look like this. I'm using RHEL7 clone.

1
  • 1
    The kill builting is documented in the bash man page. Commented Aug 21, 2016 at 21:50

2 Answers 2

4

It can still be a shell built-in even when not documented:

~ (101) bash tom@vmw-debian7-64:~$ kill -l 1) SIGHUP 2) SIGINT 3) SIGQUIT 4) SIGILL 5) SIGTRAP 6) SIGABRT 7) SIGBUS 8) SIGFPE 9) SIGKILL 10) SIGUSR1 11) SIGSEGV 12) SIGUSR2 13) SIGPIPE 14) SIGALRM 15) SIGTERM 16) SIGSTKFLT 17) SIGCHLD 18) SIGCONT 19) SIGSTOP 20) SIGTSTP 21) SIGTTIN 22) SIGTTOU 23) SIGURG 24) SIGXCPU 25) SIGXFSZ 26) SIGVTALRM 27) SIGPROF 28) SIGWINCH 29) SIGIO 30) SIGPWR 31) SIGSYS 34) SIGRTMIN 35) SIGRTMIN+1 36) SIGRTMIN+2 37) SIGRTMIN+3 38) SIGRTMIN+4 39) SIGRTMIN+5 40) SIGRTMIN+6 41) SIGRTMIN+7 42) SIGRTMIN+8 43) SIGRTMIN+9 44) SIGRTMIN+10 45) SIGRTMIN+11 46) SIGRTMIN+12 47) SIGRTMIN+13 48) SIGRTMIN+14 49) SIGRTMIN+15 50) SIGRTMAX-14 51) SIGRTMAX-13 52) SIGRTMAX-12 53) SIGRTMAX-11 54) SIGRTMAX-10 55) SIGRTMAX-9 56) SIGRTMAX-8 57) SIGRTMAX-7 58) SIGRTMAX-6 59) SIGRTMAX-5 60) SIGRTMAX-4 61) SIGRTMAX-3 62) SIGRTMAX-2 63) SIGRTMAX-1 64) SIGRTMAX tom@vmw-debian7-64:~$ type kill kill is a shell builtin tom@vmw-debian7-64:~$ 

With fish:

tom@vmw-debian7-64:~$ fish Welcome to fish, the friendly interactive shell Type help for instructions on how to use fish tom@vmw-debian7-64 ~> kill -l HUP INT QUIT ILL TRAP ABRT BUS FPE KILL USR1 SEGV USR2 PIPE ALRM TERM STKFLT CHLD CONT STOP TSTP TTIN TTOU URG XCPU XFSZ VTALRM PROF WINCH POLL PWR SYS tom@vmw-debian7-64 ~> type kill kill is /bin/kill tom@vmw-debian7-64 ~> 

With zsh

tom@vmw-debian7-64:~$ zsh vmw-debian7-64% kill -l HUP INT QUIT ILL TRAP ABRT BUS FPE KILL USR1 SEGV USR2 PIPE ALRM TERM STKFLT CHLD CONT STOP TSTP TTIN TTOU URG XCPU XFSZ VTALRM PROF WINCH POLL PWR SYS vmw-debian7-64% type kill kill is a shell builtin 

With tcsh

tom@vmw-debian7-64:~$ tcsh ~ (101) kill -l HUP INT QUIT ILL TRAP ABRT BUS FPE KILL USR1 SEGV USR2 PIPE ALRM TERM STKFLT CHLD CONT STOP TSTP TTIN TTOU URG XCPU XFSZ VTALRM PROF WINCH POLL PWR SYS RTMIN RTMIN+1 RTMIN+2 RTMIN+3 RTMAX-3 RTMAX-2 RTMAX-1 RTMAX ~ (102) type kill type: Command not found. ~ (103) which kill kill: shell built-in command. ~ (104) which which which: shell built-in command. 

It is a built-in for dash also, but the listing is a single column...

... RTMAX-8 RTMAX-7 RTMAX-6 RTMAX-5 RTMAX-4 RTMAX-3 RTMAX-2 RTMAX-1 RTMAX $ type kill kill is a shell builtin $ which kill /bin/kill $ /bin/kill -l HUP INT QUIT ILL TRAP ABRT BUS FPE KILL USR1 SEGV USR2 PIPE ALRM TERM STKFLT CHLD CONT STOP TSTP TTIN TTOU URG XCPU XFSZ VTALRM PROF WINCH POLL PWR SYS 

I would get similar results for other systems (the nice thing about portable code). As for whereis, the manual page says

 WHEREIS(1) User Commands WHEREIS(1) NAME whereis - locate the binary, source, and manual page files for a com‐ mand 

note the binary (it does not try to look for shell built-ins or aliases).

1

kill is a shell built-in:

$ type kill kill is a shell builtin 

...which explains the slightly different implementations in different shells.

which (and whereis) are not themselves shell builtins, so they cannot reliably tell you whether another command is actually a shell builtin, only whether or not (and where) they can find a copy of that command that isn't a builtin.

1
  • There should also be a /bin/kill and its output with the -l option should look like with the fish-shell. Commented Aug 21, 2016 at 21:18

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.