killall for this terminal only
Clash Royale CLAN TAG#URR8PPP
up vote
1
down vote
favorite
When debugging I often use killall
to kill a process. This is really a bad habit because there might be more processes running of the same name on the system.
Normally the process I want to kill is a descendant from the same parent (or grandparent) as killall
is started from. Often I want to kill a program started in the same terminal or a terminal in another tab (in Konsole).
Is there a way to tell killall
(or another killer) to limit the scope to processes started from this terminal or processes that are descendants from the same (grand)parent?
kill
add a comment |
up vote
1
down vote
favorite
When debugging I often use killall
to kill a process. This is really a bad habit because there might be more processes running of the same name on the system.
Normally the process I want to kill is a descendant from the same parent (or grandparent) as killall
is started from. Often I want to kill a program started in the same terminal or a terminal in another tab (in Konsole).
Is there a way to tell killall
(or another killer) to limit the scope to processes started from this terminal or processes that are descendants from the same (grand)parent?
kill
Would this be an acceptable alternative?ps
selects processes at the terminal scope by default, which could then be piped toxargs kill
.
– Haxiel
Nov 22 at 9:40
add a comment |
up vote
1
down vote
favorite
up vote
1
down vote
favorite
When debugging I often use killall
to kill a process. This is really a bad habit because there might be more processes running of the same name on the system.
Normally the process I want to kill is a descendant from the same parent (or grandparent) as killall
is started from. Often I want to kill a program started in the same terminal or a terminal in another tab (in Konsole).
Is there a way to tell killall
(or another killer) to limit the scope to processes started from this terminal or processes that are descendants from the same (grand)parent?
kill
When debugging I often use killall
to kill a process. This is really a bad habit because there might be more processes running of the same name on the system.
Normally the process I want to kill is a descendant from the same parent (or grandparent) as killall
is started from. Often I want to kill a program started in the same terminal or a terminal in another tab (in Konsole).
Is there a way to tell killall
(or another killer) to limit the scope to processes started from this terminal or processes that are descendants from the same (grand)parent?
kill
kill
asked Nov 22 at 8:42
Ole Tange
11.9k1450105
11.9k1450105
Would this be an acceptable alternative?ps
selects processes at the terminal scope by default, which could then be piped toxargs kill
.
– Haxiel
Nov 22 at 9:40
add a comment |
Would this be an acceptable alternative?ps
selects processes at the terminal scope by default, which could then be piped toxargs kill
.
– Haxiel
Nov 22 at 9:40
Would this be an acceptable alternative?
ps
selects processes at the terminal scope by default, which could then be piped to xargs kill
.– Haxiel
Nov 22 at 9:40
Would this be an acceptable alternative?
ps
selects processes at the terminal scope by default, which could then be piped to xargs kill
.– Haxiel
Nov 22 at 9:40
add a comment |
1 Answer
1
active
oldest
votes
up vote
2
down vote
accepted
If you want to kill all processes from this session (processes which have the current tty as their controlling terminal):
tty=`tty`; pkill -t "$tty#/dev/"
Or even simpler:
pkill -s 0
According to pkill(1):
-s, --session sid,...
Only match processes whose process session ID is listed. Ses-
sion ID 0 is translated into pgrep's or pkill's own session ID.
Both the -t
and the -s
options could be combined (ANDed) with a pattern and other options, eg. pgrep -s0 -x foo
for the processes from this session named exactly foo
. Unfortunately, neither pgrep
nor pkill
support complex, tcpdump
-style predicates.
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
2
down vote
accepted
If you want to kill all processes from this session (processes which have the current tty as their controlling terminal):
tty=`tty`; pkill -t "$tty#/dev/"
Or even simpler:
pkill -s 0
According to pkill(1):
-s, --session sid,...
Only match processes whose process session ID is listed. Ses-
sion ID 0 is translated into pgrep's or pkill's own session ID.
Both the -t
and the -s
options could be combined (ANDed) with a pattern and other options, eg. pgrep -s0 -x foo
for the processes from this session named exactly foo
. Unfortunately, neither pgrep
nor pkill
support complex, tcpdump
-style predicates.
add a comment |
up vote
2
down vote
accepted
If you want to kill all processes from this session (processes which have the current tty as their controlling terminal):
tty=`tty`; pkill -t "$tty#/dev/"
Or even simpler:
pkill -s 0
According to pkill(1):
-s, --session sid,...
Only match processes whose process session ID is listed. Ses-
sion ID 0 is translated into pgrep's or pkill's own session ID.
Both the -t
and the -s
options could be combined (ANDed) with a pattern and other options, eg. pgrep -s0 -x foo
for the processes from this session named exactly foo
. Unfortunately, neither pgrep
nor pkill
support complex, tcpdump
-style predicates.
add a comment |
up vote
2
down vote
accepted
up vote
2
down vote
accepted
If you want to kill all processes from this session (processes which have the current tty as their controlling terminal):
tty=`tty`; pkill -t "$tty#/dev/"
Or even simpler:
pkill -s 0
According to pkill(1):
-s, --session sid,...
Only match processes whose process session ID is listed. Ses-
sion ID 0 is translated into pgrep's or pkill's own session ID.
Both the -t
and the -s
options could be combined (ANDed) with a pattern and other options, eg. pgrep -s0 -x foo
for the processes from this session named exactly foo
. Unfortunately, neither pgrep
nor pkill
support complex, tcpdump
-style predicates.
If you want to kill all processes from this session (processes which have the current tty as their controlling terminal):
tty=`tty`; pkill -t "$tty#/dev/"
Or even simpler:
pkill -s 0
According to pkill(1):
-s, --session sid,...
Only match processes whose process session ID is listed. Ses-
sion ID 0 is translated into pgrep's or pkill's own session ID.
Both the -t
and the -s
options could be combined (ANDed) with a pattern and other options, eg. pgrep -s0 -x foo
for the processes from this session named exactly foo
. Unfortunately, neither pgrep
nor pkill
support complex, tcpdump
-style predicates.
edited Nov 22 at 10:51
answered Nov 22 at 9:43
mosvy
4,831322
4,831322
add a comment |
add a comment |
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f483386%2fkillall-for-this-terminal-only%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Would this be an acceptable alternative?
ps
selects processes at the terminal scope by default, which could then be piped toxargs kill
.– Haxiel
Nov 22 at 9:40