A feature provided by interactive programs such as shells and text editors that inserts text to complete a word or phrase that the user is likely intending to compose.

learn more… | top users | synonyms (2)

37
votes
2answers
5k views

Rebuild auto-complete index (or whatever it's called) and binaries in $PATH cache in zsh

After installing new software, an already opened terminal with zsh won't know about the new commands and cannot generate auto-complete for those. Apparently opening a new terminal fix the problem, but ...
25
votes
2answers
15k views

An easy bash completion tutorial? [closed]

I want to learn how to write bash completion scripts. Which tutorial would you recommend for a newbie?
25
votes
0answers
658 views

Completing avfs fake directories in zsh

How can I tweak zsh's completion system to complete “fake” files in some circumstances? More precisely, the AVFS filesystem exposes archives as directories by creating a “fake directory” next to ...
23
votes
1answer
600 views

How do I redirect command completion output?

On the command line, I can redirect or pipe output of a command to a file or another command using the > or | operator after the command. I have come across a less standard situation that I would ...
21
votes
3answers
7k views

How to enable autocompletion for remote paths when using scp?

I remote copied a file to my laptop using: scp someFile USER@192.168.178.32:/home/USER/put/it/some/where/oh/damn/you/here I want to be able to autocomplete the remote path by hitting tab.
20
votes
4answers
8k views

Command-line completion from command history

So, I've looked at history and at Ctrl+R, but they are not what I thought I knew. Is there a way that I can type in the beginning of a command, and cycle through the matches in my history with some ...
20
votes
3answers
2k views

How does TAB auto-complete find options to complete?

And how does it also autocomplete aliases?
19
votes
1answer
3k views

How do I get bash completion for command aliases?

I am looking to get tab-completion on my command line aliases, for example, say I defined the following alias : alias apt-inst='sudo aptitude install' Is there a way to get the completions ...
17
votes
3answers
228 views

Disable tab completion in Bash for some directory that contains a large number of files?

I'm working with large number of files, which I keep in a directory. Every time I go in to that directory and accidentally press Tab twice, it takes too long (may be over a minutes) to show files that ...
15
votes
1answer
596 views

How to fix tab completion so it doesn't hide entries?

I'm using oh-my-zsh on Mac OS X with homebrew'ed zsh 4.3.12. I stumbled recently on a weird problem. In scripts/not-used I have several .R files: breakdowns.R eventloop.R ...
13
votes
3answers
883 views

How to eliminate annoyances when starting a GUI from a terminal?

I prefer to launch GUI applications from a terminal window rather than by using a graphical desktop. A frequent annoyance is that often the developers haven't anticipated this type of use, so the app ...
13
votes
3answers
2k views

How can I tell bash valid tab-completions for arguments to my Python script

Say I have a program hello.py and one possible valid argument to it is: ./hello.py autoawesomesauce Is is possible to type in: ./hello.py auto[tab] at which point the partially completed ...
12
votes
2answers
3k views

Make zsh completion show the first guess on the same line (like fish's)

In Fish when you start typing, autocompletion automatically shows the first autocompleted guess on the line itself. In zsh you have to hit tab, and it shows the autocompletion below. Is there anyway ...
12
votes
1answer
2k views

Add arguments from previous command to zsh completion

In zsh (as well as bash) you can use some history word expansions to denote arguments from previous commands. This example shows getting the 2nd parameter from the previous command in history with ...
12
votes
1answer
609 views

Dynamically update completion list in zsh

I find zsh's result lists for Tab completion quite useful, however I'd like to tweak their behaviour a bit: They should appear when I Tab for the first time and afterwards dynamically update with ...
11
votes
1answer
3k views

Terminal autocomplete: cycle through suggestions

I had this on my Ubuntu setup and since I switched to Fedora I want to set it and I forgot how... The idea is simple : I don't want the terminal to show me suggestions when I double tab, instead I ...
11
votes
1answer
435 views

How do command-line tools have their own autocomplete list?

How does Bash in Ubuntu know a tool's specific list of actions? For example if I type apt-get and tab twice I only see remove, update, upgrade ...etc, but not the actions for another command or the ...
11
votes
2answers
147 views

Cancel completion, but only completion, in zsh

When a completion function takes a long time, I can interrupt it by pressing Ctrl+C (terminal interrupt key, sends SIGINT) or Ctrl+G (bound to send-break). I am then left with the uncompleted word. ...
11
votes
1answer
530 views

Bash completion for comma-separated values

I would like to create completion rule for comma-separated parameters list. E.g. I have command which receives list of server names: myscript -s name1,name2,name3 At this moment I've managed to ...
10
votes
5answers
2k views

Weird Stuff in Terminal When I Hit Tab

For some reason, today, everytime I hit tab in the terminal this shows up: cat bash: warning: setlocale: LC_CTYPE: cannot change locale (en_CA) Display all 150 possibilities? (y or n) This ...
10
votes
1answer
421 views

Bash tab completion expands “~” into “/home/___” when it didn't before

Previously, if I typed ~/biTab, before, it would turn into ~/bin. However, today it started turning ~/biTab into /home/username/bin. I would rather have it the former, but I'm not sure what happened ...
9
votes
3answers
700 views

How to pipe the list of commands displayed by of “tab complete”?

When using commands in bash I like the double tab option to display the available commands. Some commands have more possible matches than others: Is there a way I can pipe the output of the double ...
9
votes
2answers
2k views

Make BASH's Tab Completion Fill In First Match?

Is there any way to make BASH fill in the first match when I press TAB, kind of like the Windows command prompt? (It should still display the list of matches, but it should cycle through them when I ...
9
votes
2answers
1k views

Command line prediction

I've found an interesting paper: Predicting UNIX Command Lines about command-line prediction (based on user past activity), and I wonder if any actual implementation of such thing exists?
9
votes
3answers
278 views

Bash autocomplete with vim command

In bash, autocompletion of paths has recently stopped working when issuing vim commands where the path is deeper than two directories (it continues to work as expected with other commands, such as ls ...
9
votes
3answers
278 views

How to customize Bash command completion?

In bash, it's easy enough to set up customized completion of command arguments using the complete built-in. For example, if, for a hypothetical command with a synopsis of foo --a | --b | --c, you ...
8
votes
6answers
466 views

How to disable emacs here document completion

When editing a bash script file with emacs, and trying to enter <<<, at the second < emacs insert a template for a here document, like in the following example: <<EOF EOF This is ...
8
votes
3answers
524 views

Select unicode filename in Bash

Ok; suppose I'm in Bash and I have several files in a folder. Several of them are named file☠☡☢☣.txt, where ☠☡☢☣ starts with crazy untypable unicode characters. How would I refer to one of them? ...
8
votes
1answer
3k views

How to specify a custom autocomplete for specific commands? [duplicate]

Is there a way to have bash know exactly what to display when you double tab? For example I have a python script scpy which requires a couple arguments. For example like apt-get, if you double tab ...
8
votes
1answer
124 views

Disable Bash autocompletion for a specific command only

Is it possible to disable Bash's autocompletion for a specific command only? Use case: For obvious reasons, I would like to disable autocompletion for the rm command when I'm root. It would also be a ...
8
votes
1answer
983 views

Bash autocomplete in ssh session

It seems that bash doesn't want to autocomplete commands (what's annoying me right now is not autocompleting apt-get) when I'm logged into my machine from SSH. Is there some setting that will allow ...
8
votes
2answers
2k views

How to debug and fix slow autocomplete in bash?

After a recent update (Ubuntu 12.04 LTS), TAB complete on the command line is slow. After entering a partial command (e.g evi [TAB]) or partial filename (e.g. evince somedocu[TAB]) the shell, ...
7
votes
2answers
1k views

How to implement package install suggestion on Debian?

I have noticed that while on Ubuntu, if I type the following: mc and it isnt installed, I get the message below: The program 'mc' is currently not installed. You can install it by typing: sudo ...
7
votes
1answer
131 views

Change zsh completion to put completions above the prompt

I'm a long-time tcsh user that finally decided to try out zsh. I've been toying around with completion, but one thing I don't like is that when I hit tab for a completion that might have a lot of ...
7
votes
2answers
2k views

Create bash completion script to autocomplete paths after is-equal sign?

I want to create a bash completion script which recognises arguments of the form --arg and --some-arg=file. After reading this tutorial and some examples in /usr/share/bash_completion/completions/, ...
7
votes
1answer
282 views

compgen : ignoring case

I'm trying to implement a custom bash completion as described here. However, it seems that compgen is case-sensitive. Is there a way to turn it case-insensitive in that context ?
7
votes
1answer
385 views

How to output string completions to stdout?

Some of the git commands have many options, and it would often be useful to search through them for the one I need - I was just looking for the option which controls the TAB width in git-gui, but ...
7
votes
2answers
310 views

Need help on this bash auto completion script

I'm trying to setup autocompletion for a command, which takes only one parameter, a folder name, In /secure/kernel_builds/, I have the three following subfolder: 3.5.6/ 3.6.2/ source/ Now I want ...
6
votes
3answers
497 views

Bash autocomplete gives different file name than ls

An incredibly strange thing just happened. Through a serious typo, I entered cp filename.xsl .^?~ Yeah, that's right, dot-caret-questionmark-tilde! Truth is stranger than fiction. It gets weirder. ...
6
votes
3answers
3k views

How to turn off the beep only in bash tab-complete

I find the beep useful for some things, so I only want to turn it off for tab completion (I'm not asking how to completely turn it off, that has already been answered in a different question on ...
6
votes
3answers
1k views

Tab-completion for Mercurial in Bash?

Using Subversion on the command-line, it intelligently tab-completes available subcommands, etc: $ svn c<tab> cat checkout cl co copy changelist ci ...
6
votes
4answers
2k views

How does Bash path completion work with sudo?

Tab path completion does not work (at least on Ubuntu and AFAIK Arch) with sudo mount <whatever> The iso file I am trying to mount is not in /etc/fstab. If I just type mount <whatever> ...
6
votes
1answer
151 views

Zsh auto complete suggest complete functions (_git _vim etc)

I have a small annoyance with how zsh is doing complete suggestions for my commands. If I type the beginning of a command that I don't have installed and press tab it will suggest the completion ...
6
votes
1answer
599 views

Cancel zsh tab completion

Is there a way to cancel a completion once it has been started? I sometimes foolishly press tab to autocomplete make targets (only from sheer indolence) and then end up having to wait for a longer ...
6
votes
3answers
204 views

How to order files by date in tab completion list

$ 7z l ~/Downloads/Tab How to make the resulting list to be sorted by date, not by name? I currently use special script to list N most recent files in a given directory (and copy the filename ...
5
votes
1answer
895 views

Git auto-complete

I am using Git as many of you do. Also, I don't use any GUI for that — just CLI. So I was wondering: are there any way to make Git commands (git status, git checkout etc.) complete themselves when ...
5
votes
2answers
1k views

is there a way to set coloring for cd tab complete?

I use ubuntu 11.04. Is there a way to set coloring for output after tab completion listing of a cd, ls, or etc. ? i.e. myshell@root$ cd ~/user/files/ I hit tab... myfile myfoo mybar <-- this ...
5
votes
2answers
1k views

vim custom pop up menu

How do I create a custom completion pop up menu. I would like to be able to begin typing a part of a string then press a custom key combination to bring up a pop up completion of just a certain group ...
5
votes
4answers
6k views

Apt-get autocompletion

I am currently running 64-bit Debian Wheezy. I am having some trouble with auto completion for apt-get. I have bash-completion installed. If I am logged in as root in a shell, I can use auto ...
5
votes
1answer
1k views

How do I get my shell functions to make use of existing autocompletion in zsh?

I have a couple of shell functions defined in my .zshrc which save on typing and allow integration with screen. For example: function s() { screen -t "$1" ssh "$@" } However, when I use these ...