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;
}







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










share|improve this question




















  • 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 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






  • 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


















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










share|improve this question




















  • 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 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






  • 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














0












0








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










share|improve this question
















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






share|improve this question















share|improve this question













share|improve this question




share|improve this question








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 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






  • 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





    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











  • @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





    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










1 Answer
1






active

oldest

votes


















2














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.






share|improve this answer


























  • 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














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
});


}
});














draft saved

draft discarded


















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









2














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.






share|improve this answer


























  • 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


















2














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.






share|improve this answer


























  • 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
















2












2








2







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.






share|improve this answer















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.







share|improve this answer














share|improve this answer



share|improve this answer








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





















  • 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




















draft saved

draft discarded




















































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.




draft saved


draft discarded














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





















































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







Popular posts from this blog

How did Captain America manage to do this?

迪纳利

南乌拉尔铁路局