Tagged Questions
1
vote
0answers
12 views
osx - 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 ...
1
vote
0answers
33 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
48 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
92 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
33 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
60 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
45 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 ...
2
votes
1answer
60 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 ...
22
votes
1answer
501 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
35 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
0answers
67 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
341 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 ...
2
votes
0answers
92 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
76 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
100 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
68 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
151 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
337 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
80 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
40 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
48 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?
2
votes
1answer
151 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
188 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
80 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
84 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
54 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
88 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
66 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
97 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
112 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
90 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 ...
7
votes
3answers
295 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
164 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
133 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
...
3
votes
1answer
250 views
Enable Bash-Completion to expand Superuser executables to full path
I'm running OpenSUSE 12.3 (and have seen the behavior since 11), and have found that I can't call Superuser programs (e.g. shutdown, reboot) without using the full path. For me, many of these ...
2
votes
1answer
100 views
Autocomplete doesn't work for file parameters to jarsigner
I'm using Lubuntu 12.10. Assume I've got a file called test.apk in my current folder.
1.) In LXTerminal/bash if I type,
adb install t<TAB>
the terminal autocompletes it correctly to ...
1
vote
1answer
104 views
How to make a custom bash tab completion? [duplicate]
I want to make tab completion to complete on specific programs in path although there maybe other possible completion in path.
For example, if I type mpl and tab, it should complete to mplayer ...
0
votes
0answers
133 views
Unable to autocomplete ONLY when typing a make command
I'm running Ubuntu Linux 10.04.
And I have the following in my .bashrc file:
if [ -f /etc/bash_completion ] && ! shopt -oq posix; then
. /etc/bash_completion
fi
I'm having a problem ...
5
votes
2answers
457 views
How can I fix this SSH hostname tab completion script?
I found the following script (for bash) that enables me to get tab completion for any hostname I've connected to (from ~/.ssh/known_hosts):
complete -W "$(echo `cat ~/.ssh/known_hosts | cut -f 1 -d ' ...
5
votes
3answers
296 views
Custom autocomplete: deal with spaces in filenames
A bit of context, this question is a follow-up of this one: Bash remote autocompletion : change the 'starting' directory
Anyway, I'm writing my custom autocompletion bash script: I want the ...
3
votes
2answers
272 views
How do I let bash autocomplete wildcards?
If I have directory containing the files
foo.bar.a.cat
foo.bar.a.hat
and I type ls f+TAB the bash shell autocompletes to ls foo.bar.a.. If I type ls *bar*+ TAB I would like it to autocomplete to ...
4
votes
1answer
394 views
Tab completion doesn't work for arguments when command is an alias
I have an alias, ee, defined for my favorite editor, mg. When I do something like
mg fo
and then hit tab, if a file foo exists, I get tab completion to:
mg foo
On most systems I use (e.g., all ...
3
votes
1answer
233 views
Bash remote autocompletion : change the 'starting' directory
I'm regularly downloading files from a remote server, always from the same directory. So I wrote a custom function that I put in my bashrc:
download_from_myserver () {
for file in "$@"
do
...
3
votes
4answers
268 views
How to set proper monitoring of my services in a automated way? So that if one crash it auto on the fly restarts?
How can i setup monitoring to my system services?
Either using automated script which scan every moment, if httpd, mysqld, and my custom daemon is running or not, if not running it will automatically ...
4
votes
3answers
2k 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 ...
3
votes
1answer
50 views
Is there an easy way to change bash suggestions?
I've noticed that some console commands (like sudo or xargs) are using different kind of suggestions when I press Tab (they suggest programs instead of files).
Is there a way to mimic that kind of ...
6
votes
2answers
1k 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, ...
4
votes
4answers
122 views
Bash-completion and grep
I installed a program (iftop) on Debian Squeeze but some days ago I forgot it's name.
I had only this information about the program:
1) It was called *top
2) I could find it using bash-completions.
...
6
votes
2answers
854 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 ...
1
vote
1answer
336 views
bash autocomplete not working, does not 'complete'
I my bashrc. I have a bash completion for the command scp implemented as follows
function _scp_complete
{
COMPREPLY=""
COMPREPLY+=( $(cat ~/.ssh_complete ) )
COMPREPLY+=( $( find . ! -name . ...