Is it possible to achieve autocomplete to predifined text in gnome-terminal?
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}
I have started learning Ubuntu since 1 year..
During this 1 year period I typed a lot of these below texts in gnome-terminal
sudo -H nautilus /foo1/foo2/foo3/foo4/
sudo -H gedit /foo1/foo2/foo3/foo4/
what i am trying to ask is,
Is there a way I can configure like if I
type sn
and then press TAB, Autocompletion to sudo -H nautilus
type sg
TAB, Autocompletion to sudo -H gedit
I am Using Ubuntu 18.04 & 18.10 with gnome-terminal
Edit: I am not looking to type sn /foo1/foo2/foo3/foo4
or sg /foo1/foo2/foo3/foo4
.
looking for sn TAB or sn TAB TAB to see the text on terminal as sudo -H nautilus
command-line auto-completion
|
show 2 more comments
I have started learning Ubuntu since 1 year..
During this 1 year period I typed a lot of these below texts in gnome-terminal
sudo -H nautilus /foo1/foo2/foo3/foo4/
sudo -H gedit /foo1/foo2/foo3/foo4/
what i am trying to ask is,
Is there a way I can configure like if I
type sn
and then press TAB, Autocompletion to sudo -H nautilus
type sg
TAB, Autocompletion to sudo -H gedit
I am Using Ubuntu 18.04 & 18.10 with gnome-terminal
Edit: I am not looking to type sn /foo1/foo2/foo3/foo4
or sg /foo1/foo2/foo3/foo4
.
looking for sn TAB or sn TAB TAB to see the text on terminal as sudo -H nautilus
command-line auto-completion
3
Autocompletion is not done by the terminal emulator (e.g. gnome-terminal) but the shell (e.g. bash, zsh). Please modify the question accordingly, stating which shell you use.
– egmont
Mar 24 at 9:20
Autocompletion is done on a character or partial string of a command. What you're asking is full conversion from1
to a completely different string of text, so I'm 90% sure this is not possible. What I'd suggest is creating a function or alias. Function and alias names don't allow for numeric names, so usesn
andsg
forsudo -H nautilus
andsudo -H gedit
instead.
– Sergiy Kolodyazhnyy
Mar 24 at 9:33
@PRATAP Please see the linked duplicate. The form would be eithersn(){ sudo -H nautilus "$@" ; }
orfunction sn(){ sudo -H nautilus "$@" ;}
Of course the usage issn /path/to/directory
. Where to put those functions is explained in linked duplicate. I'll provide couple extra links in a minute
– Sergiy Kolodyazhnyy
Mar 24 at 9:49
1
To me it sounds like you want text expansion. There is a zsh plugin that supposedly works as you described it, albeit not using TAB but any other keyboard shortcut.
– danzel
Mar 24 at 10:03
@PRATAP I've posted an answer on the linked duplicate that outlines the essential steps. Let me know if you have further questions
– Sergiy Kolodyazhnyy
Mar 24 at 10:06
|
show 2 more comments
I have started learning Ubuntu since 1 year..
During this 1 year period I typed a lot of these below texts in gnome-terminal
sudo -H nautilus /foo1/foo2/foo3/foo4/
sudo -H gedit /foo1/foo2/foo3/foo4/
what i am trying to ask is,
Is there a way I can configure like if I
type sn
and then press TAB, Autocompletion to sudo -H nautilus
type sg
TAB, Autocompletion to sudo -H gedit
I am Using Ubuntu 18.04 & 18.10 with gnome-terminal
Edit: I am not looking to type sn /foo1/foo2/foo3/foo4
or sg /foo1/foo2/foo3/foo4
.
looking for sn TAB or sn TAB TAB to see the text on terminal as sudo -H nautilus
command-line auto-completion
I have started learning Ubuntu since 1 year..
During this 1 year period I typed a lot of these below texts in gnome-terminal
sudo -H nautilus /foo1/foo2/foo3/foo4/
sudo -H gedit /foo1/foo2/foo3/foo4/
what i am trying to ask is,
Is there a way I can configure like if I
type sn
and then press TAB, Autocompletion to sudo -H nautilus
type sg
TAB, Autocompletion to sudo -H gedit
I am Using Ubuntu 18.04 & 18.10 with gnome-terminal
Edit: I am not looking to type sn /foo1/foo2/foo3/foo4
or sg /foo1/foo2/foo3/foo4
.
looking for sn TAB or sn TAB TAB to see the text on terminal as sudo -H nautilus
command-line auto-completion
command-line auto-completion
edited Mar 24 at 19:41
pomsky
33.3k11104136
33.3k11104136
asked Mar 24 at 9:06
PRATAPPRATAP
3,4552932
3,4552932
3
Autocompletion is not done by the terminal emulator (e.g. gnome-terminal) but the shell (e.g. bash, zsh). Please modify the question accordingly, stating which shell you use.
– egmont
Mar 24 at 9:20
Autocompletion is done on a character or partial string of a command. What you're asking is full conversion from1
to a completely different string of text, so I'm 90% sure this is not possible. What I'd suggest is creating a function or alias. Function and alias names don't allow for numeric names, so usesn
andsg
forsudo -H nautilus
andsudo -H gedit
instead.
– Sergiy Kolodyazhnyy
Mar 24 at 9:33
@PRATAP Please see the linked duplicate. The form would be eithersn(){ sudo -H nautilus "$@" ; }
orfunction sn(){ sudo -H nautilus "$@" ;}
Of course the usage issn /path/to/directory
. Where to put those functions is explained in linked duplicate. I'll provide couple extra links in a minute
– Sergiy Kolodyazhnyy
Mar 24 at 9:49
1
To me it sounds like you want text expansion. There is a zsh plugin that supposedly works as you described it, albeit not using TAB but any other keyboard shortcut.
– danzel
Mar 24 at 10:03
@PRATAP I've posted an answer on the linked duplicate that outlines the essential steps. Let me know if you have further questions
– Sergiy Kolodyazhnyy
Mar 24 at 10:06
|
show 2 more comments
3
Autocompletion is not done by the terminal emulator (e.g. gnome-terminal) but the shell (e.g. bash, zsh). Please modify the question accordingly, stating which shell you use.
– egmont
Mar 24 at 9:20
Autocompletion is done on a character or partial string of a command. What you're asking is full conversion from1
to a completely different string of text, so I'm 90% sure this is not possible. What I'd suggest is creating a function or alias. Function and alias names don't allow for numeric names, so usesn
andsg
forsudo -H nautilus
andsudo -H gedit
instead.
– Sergiy Kolodyazhnyy
Mar 24 at 9:33
@PRATAP Please see the linked duplicate. The form would be eithersn(){ sudo -H nautilus "$@" ; }
orfunction sn(){ sudo -H nautilus "$@" ;}
Of course the usage issn /path/to/directory
. Where to put those functions is explained in linked duplicate. I'll provide couple extra links in a minute
– Sergiy Kolodyazhnyy
Mar 24 at 9:49
1
To me it sounds like you want text expansion. There is a zsh plugin that supposedly works as you described it, albeit not using TAB but any other keyboard shortcut.
– danzel
Mar 24 at 10:03
@PRATAP I've posted an answer on the linked duplicate that outlines the essential steps. Let me know if you have further questions
– Sergiy Kolodyazhnyy
Mar 24 at 10:06
3
3
Autocompletion is not done by the terminal emulator (e.g. gnome-terminal) but the shell (e.g. bash, zsh). Please modify the question accordingly, stating which shell you use.
– egmont
Mar 24 at 9:20
Autocompletion is not done by the terminal emulator (e.g. gnome-terminal) but the shell (e.g. bash, zsh). Please modify the question accordingly, stating which shell you use.
– egmont
Mar 24 at 9:20
Autocompletion is done on a character or partial string of a command. What you're asking is full conversion from
1
to a completely different string of text, so I'm 90% sure this is not possible. What I'd suggest is creating a function or alias. Function and alias names don't allow for numeric names, so use sn
and sg
for sudo -H nautilus
and sudo -H gedit
instead.– Sergiy Kolodyazhnyy
Mar 24 at 9:33
Autocompletion is done on a character or partial string of a command. What you're asking is full conversion from
1
to a completely different string of text, so I'm 90% sure this is not possible. What I'd suggest is creating a function or alias. Function and alias names don't allow for numeric names, so use sn
and sg
for sudo -H nautilus
and sudo -H gedit
instead.– Sergiy Kolodyazhnyy
Mar 24 at 9:33
@PRATAP Please see the linked duplicate. The form would be either
sn(){ sudo -H nautilus "$@" ; }
or function sn(){ sudo -H nautilus "$@" ;}
Of course the usage is sn /path/to/directory
. Where to put those functions is explained in linked duplicate. I'll provide couple extra links in a minute– Sergiy Kolodyazhnyy
Mar 24 at 9:49
@PRATAP Please see the linked duplicate. The form would be either
sn(){ sudo -H nautilus "$@" ; }
or function sn(){ sudo -H nautilus "$@" ;}
Of course the usage is sn /path/to/directory
. Where to put those functions is explained in linked duplicate. I'll provide couple extra links in a minute– Sergiy Kolodyazhnyy
Mar 24 at 9:49
1
1
To me it sounds like you want text expansion. There is a zsh plugin that supposedly works as you described it, albeit not using TAB but any other keyboard shortcut.
– danzel
Mar 24 at 10:03
To me it sounds like you want text expansion. There is a zsh plugin that supposedly works as you described it, albeit not using TAB but any other keyboard shortcut.
– danzel
Mar 24 at 10:03
@PRATAP I've posted an answer on the linked duplicate that outlines the essential steps. Let me know if you have further questions
– Sergiy Kolodyazhnyy
Mar 24 at 10:06
@PRATAP I've posted an answer on the linked duplicate that outlines the essential steps. Let me know if you have further questions
– Sergiy Kolodyazhnyy
Mar 24 at 10:06
|
show 2 more comments
1 Answer
1
active
oldest
votes
In bash, you can simply use aliases to achieve what you want. Just type the alias, then continue providing the arguments with tab completion.
If you need to effectively expand your alias before executing the command, then press the hotkey Ctrl+Alt+e. Thus, after you have typed the name of your abbreviation (= an alias), press that key combination to see the alias expanded.
See here on how to create a permanent alias.
I have added a link to an askubuntu question about creating a permanent alias. In particular, you see a section # some more ls aliasses. You could add your aliasses there.
– vanadium
Mar 24 at 11:38
Glad it worked! Indeed, it takes some studying before you grasp it, but once you got it, it is very easy.
– vanadium
Mar 24 at 12:33
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "89"
};
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%2faskubuntu.com%2fquestions%2f1128229%2fis-it-possible-to-achieve-autocomplete-to-predifined-text-in-gnome-terminal%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
In bash, you can simply use aliases to achieve what you want. Just type the alias, then continue providing the arguments with tab completion.
If you need to effectively expand your alias before executing the command, then press the hotkey Ctrl+Alt+e. Thus, after you have typed the name of your abbreviation (= an alias), press that key combination to see the alias expanded.
See here on how to create a permanent alias.
I have added a link to an askubuntu question about creating a permanent alias. In particular, you see a section # some more ls aliasses. You could add your aliasses there.
– vanadium
Mar 24 at 11:38
Glad it worked! Indeed, it takes some studying before you grasp it, but once you got it, it is very easy.
– vanadium
Mar 24 at 12:33
add a comment |
In bash, you can simply use aliases to achieve what you want. Just type the alias, then continue providing the arguments with tab completion.
If you need to effectively expand your alias before executing the command, then press the hotkey Ctrl+Alt+e. Thus, after you have typed the name of your abbreviation (= an alias), press that key combination to see the alias expanded.
See here on how to create a permanent alias.
I have added a link to an askubuntu question about creating a permanent alias. In particular, you see a section # some more ls aliasses. You could add your aliasses there.
– vanadium
Mar 24 at 11:38
Glad it worked! Indeed, it takes some studying before you grasp it, but once you got it, it is very easy.
– vanadium
Mar 24 at 12:33
add a comment |
In bash, you can simply use aliases to achieve what you want. Just type the alias, then continue providing the arguments with tab completion.
If you need to effectively expand your alias before executing the command, then press the hotkey Ctrl+Alt+e. Thus, after you have typed the name of your abbreviation (= an alias), press that key combination to see the alias expanded.
See here on how to create a permanent alias.
In bash, you can simply use aliases to achieve what you want. Just type the alias, then continue providing the arguments with tab completion.
If you need to effectively expand your alias before executing the command, then press the hotkey Ctrl+Alt+e. Thus, after you have typed the name of your abbreviation (= an alias), press that key combination to see the alias expanded.
See here on how to create a permanent alias.
edited Mar 24 at 11:38
answered Mar 24 at 11:22
vanadiumvanadium
7,67811532
7,67811532
I have added a link to an askubuntu question about creating a permanent alias. In particular, you see a section # some more ls aliasses. You could add your aliasses there.
– vanadium
Mar 24 at 11:38
Glad it worked! Indeed, it takes some studying before you grasp it, but once you got it, it is very easy.
– vanadium
Mar 24 at 12:33
add a comment |
I have added a link to an askubuntu question about creating a permanent alias. In particular, you see a section # some more ls aliasses. You could add your aliasses there.
– vanadium
Mar 24 at 11:38
Glad it worked! Indeed, it takes some studying before you grasp it, but once you got it, it is very easy.
– vanadium
Mar 24 at 12:33
I have added a link to an askubuntu question about creating a permanent alias. In particular, you see a section # some more ls aliasses. You could add your aliasses there.
– vanadium
Mar 24 at 11:38
I have added a link to an askubuntu question about creating a permanent alias. In particular, you see a section # some more ls aliasses. You could add your aliasses there.
– vanadium
Mar 24 at 11:38
Glad it worked! Indeed, it takes some studying before you grasp it, but once you got it, it is very easy.
– vanadium
Mar 24 at 12:33
Glad it worked! Indeed, it takes some studying before you grasp it, but once you got it, it is very easy.
– vanadium
Mar 24 at 12:33
add a comment |
Thanks for contributing an answer to Ask Ubuntu!
- 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%2faskubuntu.com%2fquestions%2f1128229%2fis-it-possible-to-achieve-autocomplete-to-predifined-text-in-gnome-terminal%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
3
Autocompletion is not done by the terminal emulator (e.g. gnome-terminal) but the shell (e.g. bash, zsh). Please modify the question accordingly, stating which shell you use.
– egmont
Mar 24 at 9:20
Autocompletion is done on a character or partial string of a command. What you're asking is full conversion from
1
to a completely different string of text, so I'm 90% sure this is not possible. What I'd suggest is creating a function or alias. Function and alias names don't allow for numeric names, so usesn
andsg
forsudo -H nautilus
andsudo -H gedit
instead.– Sergiy Kolodyazhnyy
Mar 24 at 9:33
@PRATAP Please see the linked duplicate. The form would be either
sn(){ sudo -H nautilus "$@" ; }
orfunction sn(){ sudo -H nautilus "$@" ;}
Of course the usage issn /path/to/directory
. Where to put those functions is explained in linked duplicate. I'll provide couple extra links in a minute– Sergiy Kolodyazhnyy
Mar 24 at 9:49
1
To me it sounds like you want text expansion. There is a zsh plugin that supposedly works as you described it, albeit not using TAB but any other keyboard shortcut.
– danzel
Mar 24 at 10:03
@PRATAP I've posted an answer on the linked duplicate that outlines the essential steps. Let me know if you have further questions
– Sergiy Kolodyazhnyy
Mar 24 at 10:06