I know how to kill a job with kill
%(number) but is it possible to kill a job as background job, the question is "kill
tail as a background job?"
There are several ways to specify jobs, including
%foo to designate the job whose command starts with
%?foo to designate the job whose command contains the substring
foo. You need to specify an unambiguous prefix or substring: if more than one string matches, the shell reports an error. This is a POSIX feature.
(Note that this is specifically to kill a background job of the current shell. If you want to kill all
tail processes running as your user regardless of whether they're a job of the current shell, you can use
pkill. Obviously, with a common utility such as
tail, this could cause collateral damage; run the
pgrep command with the same arguments first to see what would be killed.)
Killing it like any other process should work:
Though if you want to be careful with that, you can check the PID with top, htop, or ps ahead of time.