To understand the problem of why Ctrl + C does not work, it is very helpful to understand what happens when you press it:
Most shells bind Ctrl + C to "send a SIGINT signal to the program that currently runs in the foreground". You can read about the different signals via man signal:
SIGINT 2 Term Interrupt from keyboard
Programs can ignore that signal, as they can ignore SIGTSTP as well:
SIGTSTP 18,20,24 Stop Stop typed at tty
(Which is what most shells do when you press Ctrl + Z, which is why it is not guaranteed to work.)
There are some signals which can not be ignored by the process: SIGKILL, SIGSTOP and some others. You can send these signals via the kill command. So, to kill your hanging / zombieying process, just find the process ID (PID). For example, use pgrep
or ps
and then kill
it:
% kill -9 PID
path-directories
One way is to add the following completion settings in your .zshrc
to remove path-directories
from the suggestion sources.
zstyle ':completion:*:complete:(cd|pushd):*' tag-order \
'local-directories named-directories'
group names
Alternatively or additionally, the following settings should display a heading for all respective groups of completion suggestions so you can see which directories are local directories and which are suggestions from your cdpath
.
zstyle ':completion:*' group-name ''
zstyle ':completion:*:descriptions' format %d
You can apply standard prompt formats to these descriptions to make them stand out:
zstyle ':completion:*:descriptions' format %B%d%b # bold
# zstyle ':completion:*:descriptions' format %S%d%s # invert/standout
# zstyle ':completion:*:descriptions' format %U%d%u # underline
# zstyle ':completion:*:descriptions' format %F{green}%d%f # green foreground
# zstyle ':completion:*:descriptions' format %K{blue}%d%k # blue background
# etc.
That helps make sense of the different sources quite a bit in my experience.
Note 1: zsh
has two representations for array variables like PATH
and CDPATH
, of which the lower case variant is an actual array. This means you can:
cdpath=(path/to/dir /path/to/another/dir)
Or, to get your desired result:
cdpath=(.. ../..)
I personally find it a bit more readable than the colon-separated pseudo array.
Note 2: Exporting CDPATH
isn't necessary unless you have several programs that want it set.
Best Answer
Considering how linux jobs and process ownership works, I'm afraid it's not really possible to re-own a process, without help from the adopting process.
A parent may 'disown' a child, which is then 'adopted' by the process named 'init'. System security prevents someone from grabbing someone else's processes. When you disown it, a process becomes someone else's (init's) to control. You as the 'user' could still kill the process, but you can't get it back. Attempting to coerce init to return your process is unlikely to work, as init doesn't even read mail.
As mean as it sounds, it really boils down to the answer of "Don't do that!".