Skip to content

How to use bg and fg ? #3524

Answered by Andriamanitra
iroku312 asked this question in Q&A
Oct 31, 2024 · 1 comments · 2 replies
Discussion options

You must be logged in to vote

You can emulate the usual Ctrl-z behavior by sending TSTP (terminal stop) signal to the process. That may be done from inside micro by running a command: run sh -c 'kill -s TSTP $PPID'. This starts a new subprocess that sends the signal to its parent process (identified by the $PPID environment variable). However this seems to leave the terminal in a messy state (the screen is not cleared when micro receives the signal, and the screen is also not properly restored when you foreground micro again), and I don't think there's any easy way to fix it (except patching micro to handle the signal gracefully).

~/.config/micro/bindings.json

{
    "Ctrl-z": "command:run sh -c 'kill -s TSTP $PPID'",
}

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@iroku312
Comment options

@Andriamanitra
Comment options

Answer selected by iroku312
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants