Start process in background at keybind (append `& disown` on Ctrl+Enter)
up vote
1
down vote
favorite
Let's say I want to open Chrome, Sublime Idea, etc. from the command line while maintaining the control of the terminal.
Is there a way to append & disown
to the command in Bash when you press Ctrl+Enter or other convenient combination?
I tried to make alias for them, e.g. alias subl='subl & disown'
, but passing arguments won't work anymore and having to write aliases for all the programs I want to use this way is too much of a hassle. There has to be a smarter way.
command-line bash
add a comment |
up vote
1
down vote
favorite
Let's say I want to open Chrome, Sublime Idea, etc. from the command line while maintaining the control of the terminal.
Is there a way to append & disown
to the command in Bash when you press Ctrl+Enter or other convenient combination?
I tried to make alias for them, e.g. alias subl='subl & disown'
, but passing arguments won't work anymore and having to write aliases for all the programs I want to use this way is too much of a hassle. There has to be a smarter way.
command-line bash
1
Look at shell functions.
– Scott
Dec 9 at 0:37
I added ` "C-e": ' & disownn' ` in .inputrc and it does what I want on ctrl+e. For some reason it doesn't work with n instead of e
– Dani
Dec 9 at 0:47
add a comment |
up vote
1
down vote
favorite
up vote
1
down vote
favorite
Let's say I want to open Chrome, Sublime Idea, etc. from the command line while maintaining the control of the terminal.
Is there a way to append & disown
to the command in Bash when you press Ctrl+Enter or other convenient combination?
I tried to make alias for them, e.g. alias subl='subl & disown'
, but passing arguments won't work anymore and having to write aliases for all the programs I want to use this way is too much of a hassle. There has to be a smarter way.
command-line bash
Let's say I want to open Chrome, Sublime Idea, etc. from the command line while maintaining the control of the terminal.
Is there a way to append & disown
to the command in Bash when you press Ctrl+Enter or other convenient combination?
I tried to make alias for them, e.g. alias subl='subl & disown'
, but passing arguments won't work anymore and having to write aliases for all the programs I want to use this way is too much of a hassle. There has to be a smarter way.
command-line bash
command-line bash
edited Dec 9 at 2:27
Kamil Maciorowski
23.5k155072
23.5k155072
asked Dec 9 at 0:21
Dani
184
184
1
Look at shell functions.
– Scott
Dec 9 at 0:37
I added ` "C-e": ' & disownn' ` in .inputrc and it does what I want on ctrl+e. For some reason it doesn't work with n instead of e
– Dani
Dec 9 at 0:47
add a comment |
1
Look at shell functions.
– Scott
Dec 9 at 0:37
I added ` "C-e": ' & disownn' ` in .inputrc and it does what I want on ctrl+e. For some reason it doesn't work with n instead of e
– Dani
Dec 9 at 0:47
1
1
Look at shell functions.
– Scott
Dec 9 at 0:37
Look at shell functions.
– Scott
Dec 9 at 0:37
I added ` "C-e": ' & disownn' ` in .inputrc and it does what I want on ctrl+e. For some reason it doesn't work with n instead of e
– Dani
Dec 9 at 0:47
I added ` "C-e": ' & disownn' ` in .inputrc and it does what I want on ctrl+e. For some reason it doesn't work with n instead of e
– Dani
Dec 9 at 0:47
add a comment |
2 Answers
2
active
oldest
votes
up vote
0
down vote
accepted
From your comment:
I added
"C-e": ' & disownn'
in.inputrc
and it does what I want on Ctrl+e. For some reason it doesn't work withn
instead ofe
.
I don't think n
is the right string to use, but there's a bigger problem: in a console Enter itself is C-M
i.e. Ctrl+M, so Ctrl+Enter is just Enter and you cannot tell them apart.
You can, however, tell apart Enter and Meta (aka Alt)+Enter. Place this line into your .inputrc
:
"C-M-M":' & disownn'
and hit Meta (aka Alt)+Enter whenever you want to use it.
I also tried with shift+enter "C-J":' & disownn' , but the n at the end got me in a loop. I've replaced the n with r and now it works fine. Thanks for your answer, I'll find something useful to map it to the alt key too. Cheers
– Dani
Dec 9 at 2:46
add a comment |
up vote
1
down vote
I've learned that r shares the same ASCII code as Ctrl+M, which means Ctrl+Enter is equivalent to Ctrl+Ctrl+M. Pressing Ctrl twice doesn't make any sense, so Ctrl and Enter can't be used together in terminal without some xterm translation.
I managed to do the trick with Ctrl+E by adding "C-E": ' & disownn '
in .inputrc
.
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "3"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
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%2fsuperuser.com%2fquestions%2f1381989%2fstart-process-in-background-at-keybind-append-disown-on-ctrlenter%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
accepted
From your comment:
I added
"C-e": ' & disownn'
in.inputrc
and it does what I want on Ctrl+e. For some reason it doesn't work withn
instead ofe
.
I don't think n
is the right string to use, but there's a bigger problem: in a console Enter itself is C-M
i.e. Ctrl+M, so Ctrl+Enter is just Enter and you cannot tell them apart.
You can, however, tell apart Enter and Meta (aka Alt)+Enter. Place this line into your .inputrc
:
"C-M-M":' & disownn'
and hit Meta (aka Alt)+Enter whenever you want to use it.
I also tried with shift+enter "C-J":' & disownn' , but the n at the end got me in a loop. I've replaced the n with r and now it works fine. Thanks for your answer, I'll find something useful to map it to the alt key too. Cheers
– Dani
Dec 9 at 2:46
add a comment |
up vote
0
down vote
accepted
From your comment:
I added
"C-e": ' & disownn'
in.inputrc
and it does what I want on Ctrl+e. For some reason it doesn't work withn
instead ofe
.
I don't think n
is the right string to use, but there's a bigger problem: in a console Enter itself is C-M
i.e. Ctrl+M, so Ctrl+Enter is just Enter and you cannot tell them apart.
You can, however, tell apart Enter and Meta (aka Alt)+Enter. Place this line into your .inputrc
:
"C-M-M":' & disownn'
and hit Meta (aka Alt)+Enter whenever you want to use it.
I also tried with shift+enter "C-J":' & disownn' , but the n at the end got me in a loop. I've replaced the n with r and now it works fine. Thanks for your answer, I'll find something useful to map it to the alt key too. Cheers
– Dani
Dec 9 at 2:46
add a comment |
up vote
0
down vote
accepted
up vote
0
down vote
accepted
From your comment:
I added
"C-e": ' & disownn'
in.inputrc
and it does what I want on Ctrl+e. For some reason it doesn't work withn
instead ofe
.
I don't think n
is the right string to use, but there's a bigger problem: in a console Enter itself is C-M
i.e. Ctrl+M, so Ctrl+Enter is just Enter and you cannot tell them apart.
You can, however, tell apart Enter and Meta (aka Alt)+Enter. Place this line into your .inputrc
:
"C-M-M":' & disownn'
and hit Meta (aka Alt)+Enter whenever you want to use it.
From your comment:
I added
"C-e": ' & disownn'
in.inputrc
and it does what I want on Ctrl+e. For some reason it doesn't work withn
instead ofe
.
I don't think n
is the right string to use, but there's a bigger problem: in a console Enter itself is C-M
i.e. Ctrl+M, so Ctrl+Enter is just Enter and you cannot tell them apart.
You can, however, tell apart Enter and Meta (aka Alt)+Enter. Place this line into your .inputrc
:
"C-M-M":' & disownn'
and hit Meta (aka Alt)+Enter whenever you want to use it.
answered Dec 9 at 2:16
Kamil Maciorowski
23.5k155072
23.5k155072
I also tried with shift+enter "C-J":' & disownn' , but the n at the end got me in a loop. I've replaced the n with r and now it works fine. Thanks for your answer, I'll find something useful to map it to the alt key too. Cheers
– Dani
Dec 9 at 2:46
add a comment |
I also tried with shift+enter "C-J":' & disownn' , but the n at the end got me in a loop. I've replaced the n with r and now it works fine. Thanks for your answer, I'll find something useful to map it to the alt key too. Cheers
– Dani
Dec 9 at 2:46
I also tried with shift+enter "C-J":' & disownn' , but the n at the end got me in a loop. I've replaced the n with r and now it works fine. Thanks for your answer, I'll find something useful to map it to the alt key too. Cheers
– Dani
Dec 9 at 2:46
I also tried with shift+enter "C-J":' & disownn' , but the n at the end got me in a loop. I've replaced the n with r and now it works fine. Thanks for your answer, I'll find something useful to map it to the alt key too. Cheers
– Dani
Dec 9 at 2:46
add a comment |
up vote
1
down vote
I've learned that r shares the same ASCII code as Ctrl+M, which means Ctrl+Enter is equivalent to Ctrl+Ctrl+M. Pressing Ctrl twice doesn't make any sense, so Ctrl and Enter can't be used together in terminal without some xterm translation.
I managed to do the trick with Ctrl+E by adding "C-E": ' & disownn '
in .inputrc
.
add a comment |
up vote
1
down vote
I've learned that r shares the same ASCII code as Ctrl+M, which means Ctrl+Enter is equivalent to Ctrl+Ctrl+M. Pressing Ctrl twice doesn't make any sense, so Ctrl and Enter can't be used together in terminal without some xterm translation.
I managed to do the trick with Ctrl+E by adding "C-E": ' & disownn '
in .inputrc
.
add a comment |
up vote
1
down vote
up vote
1
down vote
I've learned that r shares the same ASCII code as Ctrl+M, which means Ctrl+Enter is equivalent to Ctrl+Ctrl+M. Pressing Ctrl twice doesn't make any sense, so Ctrl and Enter can't be used together in terminal without some xterm translation.
I managed to do the trick with Ctrl+E by adding "C-E": ' & disownn '
in .inputrc
.
I've learned that r shares the same ASCII code as Ctrl+M, which means Ctrl+Enter is equivalent to Ctrl+Ctrl+M. Pressing Ctrl twice doesn't make any sense, so Ctrl and Enter can't be used together in terminal without some xterm translation.
I managed to do the trick with Ctrl+E by adding "C-E": ' & disownn '
in .inputrc
.
edited Dec 14 at 9:54
Scott
15.5k113889
15.5k113889
answered Dec 9 at 2:15
Dani
184
184
add a comment |
add a comment |
Thanks for contributing an answer to Super User!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
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%2fsuperuser.com%2fquestions%2f1381989%2fstart-process-in-background-at-keybind-append-disown-on-ctrlenter%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
1
Look at shell functions.
– Scott
Dec 9 at 0:37
I added ` "C-e": ' & disownn' ` in .inputrc and it does what I want on ctrl+e. For some reason it doesn't work with n instead of e
– Dani
Dec 9 at 0:47