17
votes
3answers
182 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 ...
4
votes
3answers
240 views

How do I auto complete a command from the command history? [duplicate]

Is there a key combination for bash to auto compete a command from the history? In ipython and matlab for example this is achieved by pressing up arrow after typing a few characters.
4
votes
2answers
82 views

Where do bash completion functions come from?

I have a Raspberry Pi running Raspbian (Debian Wheezy). I entered set in a terminal and was surprised by the long list. This seems to be almost entirely git functions — ~3700 lines of them. ...
1
vote
1answer
30 views

Custom tab-completion in bash's `read`

Is there a way to "import" a list of words into bash's read builtin to have custom tab-completion? I've been writing a wrapper script for suckless' minimalist irc client "ii", and I don't have a way ...
3
votes
0answers
60 views

can we use something better than more for tab completion?

more is not as convenient as less. Is it possible to use something better than more for tab completion, when ls and then tab? Thanks.
2
votes
1answer
47 views

Why can't I use tab expansion/auto-complete of shell variables with cd?

I have setup a variable in .bashrc: export SOME_DIR=/path/to/some/dir Now, with ls I can type ls $SOME_DIR[tab] and the variable will be expanded, and I can then use tab for auto-completion when ...
2
votes
3answers
48 views

Hide make targets from shell when users autocomplete in bash

Is there a way to flag some targets in a Makefile so that they don't appear at all in the shell when the user types make and then presses Tab ? I am having a Makefile with too many recipes and I don't ...
1
vote
3answers
117 views

How to do command-line completion with files and folders

As a new Linux user, one of the things that's kept me away from the Command Line (CL) is that, for tasks involving files and folders (i.e. everything!), the amount of typing involved makes using the ...
12
votes
3answers
866 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 ...
3
votes
2answers
67 views

exclude particular file from bash_completion

I have a simple bash_completion code. The only thing it does, is when I type grcat and then Tab, it offers to complete filenames from /etc/grcat. _grcat() { local word COMPREPLY=() if [ 1 ...
11
votes
1answer
401 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 ...
1
vote
1answer
67 views

Bash Autocompletion (rather than tab completion)

How can I make bash show completion suggestions without having to press [tab]. I'd like the suggestions to update on each character I add and maybe to have the ability to quickly pick an option. I'd ...
1
vote
1answer
51 views

Modify $READLINE_LINE and $READLINE_POINT values inside bash script

I already asked this question on stackoveflow, but received no answer and very few views. I thought I would post here as there should be more bash users and someone might have already stumbled upon ...
8
votes
3answers
161 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 ...
5
votes
2answers
50 views

Is it possible for bash completion to cycle through the alternatives?

When using bash completion and an a number of characters have been entered, tabbing ceases to work then the prefix you have typed is matched by more than one of the possibilities. Is there a way to ...
9
votes
3answers
162 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 ...
3
votes
0answers
177 views

bash does not autocomplete my command when using sudo?

I'm using SaltStack. I would like to auto-complete the minion name when calling salt command. The following line has been added into ~/.bashrc: complete -o default -o nospace -W "$(sudo ls -1 ...
2
votes
0answers
77 views

Bash tabcomplete file names for environmental variable values

After I upgraded my Ubuntu from 12.04 to 14.04, bash would no longer let me tabcomplete file names when setting the value of an environmental variable, e.g. FILE=/home/_ _ is where I would press ...
1
vote
1answer
216 views

Autocomplete server names for SSH and SCP

I have a few servers configured in ~/.ssh/config, such as alpha and beta. How might I configure Bash such that the commands ssh al<tab> and scp file.tgz al<tab> autocomplete the names of ...
4
votes
1answer
102 views

Is there a way to customize “Programmable Completion” in the current session?

If I start typing a command or filename, I can use the tab key to auto-complete my string. That is well known... Is there a way to change the behavior of the auto complete for the current bash ...
3
votes
1answer
43 views

Redistributable completion for my bash scripts

Is there a simple way to embed the completion features inside a script, for bash ? I have a script that I want to redistribute, but I can't ask the people to add something inside their ...
4
votes
2answers
82 views

Is there a workaround for Debian file-completion trashing $_?

I have years of experience on Slackware linux, and have never seen this problem there. Lately I have been administering Debian servers, and this has become an annoyance. I frequently use "$_" in a ...
2
votes
1answer
139 views

Autojump auto-complete feature does not work

On my configuration, autojump autocomplete feature does not seem to work. To be clear, autojump works properly, only the autocomplete feature fails to work. When I press the <TAB> key, the ...
3
votes
1answer
161 views

Add autocompletion for custom script

I am currently working on a shell script I called makeyourself.sh (linked to /usr/bin/mys) which automatically installs a debian package from source (via apt-get source -b $1). So I decided to add an ...
23
votes
1answer
578 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 ...
4
votes
1answer
42 views

Tab-completion within for loops not working

I'm either going crazy or about to ask a stupidly basic question. I appreciate your patience either way. Tab completion for executable command is not working within interactive for loops in bash. I ...
3
votes
2answers
131 views

Bash autocomplete variables for other commands than cd

I have env variable $SCRIPT. Normaly I can use autocomplete vim $SC<tab> and completion works as expected. On some systems it does not work. I have bash completion loaded, but completion in ...
11
votes
1answer
478 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 ...
3
votes
1answer
187 views

how to edit and color bash's tab completion list

Following is what i would like to have. When the tab completion is ambiguous, and bash prints the list of possibilities. I would like it to colour the next character I should press inside every word ...
1
vote
1answer
90 views

Add arguments when completing a command name

I am looking for a way to expand some predefined strings in the terminal when tab (or another key combination) is pressed. This is different from tab completion. My terminal already expands ~ to my ...
4
votes
2answers
183 views

Force Bash normal tab completion if intelligent completion fails

Since tab completion became a standard feature in shells I have been a very happy user of it. I even like Bash's intelligent completion (where it only searches for PDF files, if I type evince ...
3
votes
1answer
92 views

Bash tab completion stop searching

When I am typing into bash and I press the "tab" key to auto complete, sometimes it takes a significant time. E.g., file IO to read directories takes >5 seconds, and thus I am hung waiting for IO to ...
4
votes
2answers
264 views

Completion of words on the screen as in VIM (Bash or Tmux)

How can I configure Bash, Zsh or Tmux to complete the last matching identifier on the screen? Consider this common scenario: $ git fetch remote: Counting objects: 16, done. remote: Compressing ...
4
votes
2answers
465 views

Command completion does not complete the files in the current directory

Something is wrong with my tab completion. Let's say I do this: cd test // works fine, go into test directory ls // works fine, displays all of the files Let's assume I have the following files: ...
3
votes
1answer
115 views

compgen warning: -C option not working as I expected

What is the correct way to use the compgen -C option? I'm trying to learn about Bash programmable completion, and in particular the compgen builtin function. I'm experimenting with the different ...
1
vote
1answer
68 views

How can I add autocomplete for “gem which” with rbenv?

I am using rbenv on Mac OS X. I have autocomplete functionality already for the gem command: $ gem build environment lock query stale cert fetch ...
2
votes
2answers
76 views

How to add all binaries to bash tab completion for some command?

I've installed program trickle that allow to throttle the net for specified command like: trickle -u10 -d10 <COMMAND> How to add bash completion for all binaries to trickle command?
3
votes
1answer
320 views

Bash autocompletion for an environment variable holding a directory name

I'm using, among other things, bash 4.2.37 on Linux Mint 14. When I autocomplete the name of an environment variable by typing Tab, it expands to the name of the variable followed by a space. If the ...
2
votes
3answers
259 views

How to add pattern to bash completion (for unzip)?

When I type unzip <tab> I get a list of all files ending in .zip, which is the standard behavior of tab completion for the unzip command. However, I also want bash completion for unzip ...
3
votes
1answer
97 views

code review: automatic completion for bash aliases

I was reading How do I get bash completion for command aliases? and I thought, that the answer Shawn J. Goff needed a little something: less user setup so I wrote a little script that is intended to ...
4
votes
1answer
122 views

bash_completion for initscripts

I have writen my own initscript /etc/init.d/myscript. I can start and stop my script with the service command service myscript start service myscript stop When I type service <TAB>, ...
3
votes
1answer
62 views

How to cd open / autocomplete a folder that ends in a specific phrase

I have a folder with subfolders named like this: 1122334 important things 1122335 less important things 1122336 notes 1122337 pictures of kittens etc The numbers at the beginning are date codes. ...
1
vote
1answer
166 views

How to globally enable all of Gentoo's bash completions at once?

eselect bashcomp enable unfortunately seems to lack a --all option, and I certainly don't want to manually activate each of the 194 entries. Can this be automated somehow, and set up such that ...
3
votes
1answer
74 views

How can I get Bash to display the auto-completion definitions for a given command?

I use module command to load and unload stuff to my environment, some of the machines I use have proper auto-completion others do not. I'm wondering if I it possible to know where the completion ...
8
votes
1answer
114 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 ...
1
vote
1answer
134 views

prevent bash completion from altering underscore variable $_

When using tab completion in bash, the $_ variable is altered: $ mkdir test $ cd <TAB><TAB> $_ bash: cd: -d: invalid option cd: usage: cd [-L|[-P [-e]]] [dir] (The ...
1
vote
0answers
113 views

How can I reset the bash filename completion for “more”?

I've done something that has changed the way TAB auto-complete works, but only for the more command. Every other command lists the possible completions, but more now lists ALL of the possibilities ...
8
votes
3answers
428 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? ...
6
votes
3answers
181 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 ...
3
votes
3answers
149 views

Autocomplete newest file

I have a process which creates text files whose filenames are based on the timestamp of their moment of creation: $ ls 1378971222.txt 1378971254.txt 1378971482.txt 1378971488.txt 1378972089.txt ...