Bash autocomplete with wildcards doesn't work

Hi, I just switched from Arch running Gnome to Manjaro running XFCE. In Gnome I was able to use bash autocomplete with wildcards but that functionality does not work on my system now.

For example, if I have a directory called Stuff and I type cd *f, pressing TAB would autocomplete it to cd Stuff. Similarly, if I have two directories called Downloads and Documents and I type cd D* then press TAB TAB, I want to see Documents/ Downloads/.

How can I get this functionality in my system?

System specs:

  Kernel: 5.8.16-2-MANJARO x86_64 bits: 64 compiler: N/A 
  parameters: BOOT_IMAGE=/boot/vmlinuz-5.8-x86_64 
  root=UUID=b6fb2e8b-3700-4370-94dc-da42962edaa6 rw quiet apparmor=1 
  security=apparmor udev.log_priority=3 
  Desktop: Xfce 4.14.2 tk: Gtk 3.24.20 info: xfce4-panel wm: xfwm4 
  dm: LightDM 1.30.0 Distro: Manjaro Linux 
  Type: Desktop System: ASUSTeK product: N/A v: N/A serial: <filter> 
  Mobo: ASUSTeK model: WS C246 PRO v: Rev 1.xx serial: <filter> 
  UEFI: American Megatrends v: 0802 date: 11/30/2018 
  Topology: 8-Core model: Intel Core i9-9900K bits: 64 type: MT MCP 
  arch: Kaby Lake family: 6 model-id: 9E (158) stepping: C (12) microcode: D6 
  L2 cache: 16.0 MiB 
  flags: avx avx2 lm nx pae sse sse2 sse3 sse4_1 sse4_2 ssse3 bogomips: 115232 
  Speed: 4600 MHz min/max: 800/5000 MHz Core speeds (MHz): 1: 4600 2: 4600 
  3: 4600 4: 4600 5: 4600 6: 4600 7: 4600 8: 4600 9: 4600 10: 4600 11: 4600 
  12: 4600 13: 4600 14: 4600 15: 4600 16: 4600 
  Vulnerabilities: Type: itlb_multihit status: KVM: VMX unsupported 
  Type: l1tf status: Not affected 
  Type: mds mitigation: Clear CPU buffers; SMT vulnerable 
  Type: meltdown status: Not affected 
  Type: spec_store_bypass 
  mitigation: Speculative Store Bypass disabled via prctl and seccomp 
  Type: spectre_v1 
  mitigation: usercopy/swapgs barriers and __user pointer sanitization 
  Type: spectre_v2 mitigation: Full generic retpoline, IBPB: conditional, 
  IBRS_FW, STIBP: conditional, RSB filling 
  Type: srbds mitigation: Microcode 
  Type: tsx_async_abort mitigation: Clear CPU buffers; SMT vulnerable 
  Device-1: NVIDIA TU106 [GeForce RTX 2070] vendor: PNY driver: nouveau 
  v: kernel bus ID: 01:00.0 chip ID: 10de:1f02 
  Display: x11 server: X.Org 1.20.9 driver: modesetting,nouveau 
  alternate: fbdev,nv,vesa display ID: :0.0 screens: 1 
  Screen-1: 0 s-res: 7680x2160 s-dpi: 96 s-size: 2032x571mm (80.0x22.5") 
  s-diag: 2111mm (83.1") 
  Monitor-1: DP-1 res: 3840x2160 hz: 60 dpi: 163 size: 600x340mm (23.6x13.4") 
  diag: 690mm (27.2") 
  Monitor-2: HDMI-1 res: 3840x2160 hz: 60 dpi: 163 
  size: 600x340mm (23.6x13.4") diag: 690mm (27.2") 
  OpenGL: renderer: llvmpipe (LLVM 10.0.1 256 bits) v: 3.3 Mesa 20.1.8 
  compat-v: 3.1 direct render: Yes 


Install it?

sudo pacman -S bash-completion
1 Like

@megavolt thanks, but tried that, didn’t work.


Are you using bash?

echo $SHELL

Are the completions there?

ls /usr/share/bash-completion/completions/

Adding set show-all-if-ambiguous on to ~/.inputrc file solves second part (cd D*) and with set completion-ignore-case on sould be case insensitive.

@megavolt yes, I’m using bash, v5.0.18(1)-release, and the completions directory has many files. However, I don’t need program-specific completions, rather a global functionality.

@ddns thanks, I tried those set commands but cd D* still doesn’t expand.

Try adding in .bashrc

# Autocompletion
[ -r /usr/share/bash-completion/bash_completion ] && . /usr/share/bash-completion/bash_completion

@ddns also no change with that one.

Success! Sort of. An answer comes from this post, explaining it is not straightforward to achieve this functionality using TAB, but there are other keybindings that will work: Alt+g

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.