DriversRecommendedOutdated drivers can make a good PC feel brokenScan driver issues before chasing fixes manually.Scan NowHalloween DealsAmazon USHalloween week deals: useful picks before month-endAmazon US: current deals, useful picks and tech finds.Check DealsClean PCRecommendedOne scan can reveal what keeps slowing WindowsLook for cleanup and repair opportunities.Run Scan×
Skip to content
VGSources
Blog

How to Enable Tab Completion for New Users in Ubuntu

A practical Ubuntu guide to installing bash-completion, enabling it in .bashrc, and deploying it safely for existing and future users.
WorldUbuntu Length10 min Posted Quest giverVGSources Team
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

If you are asking “How do I enable tab completion in Ubuntu?”, install Ubuntu’s bash-completion package, make sure Bash sources its loader, and start a new interactive shell. The package supplies programmable completion for commands, options, and arguments; ordinary filename completion can work even when this package is not loaded.

For one account, run sudo apt update and sudo apt install bash-completion, then check ~/.bashrc. To turn it on for every newly created account, configure the system-wide interactive Bash startup path and verify the target release’s skeleton and profile files rather than assuming every Ubuntu version uses identical defaults.

As an Amazon Associate I earn from qualifying purchases.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

How do I enable tab completion in Ubuntu?

The shortest reliable setup for your current user is:

  1. Update the package index and install the package:
    sudo apt update
    sudo apt install bash-completion
  2. Open your Bash startup file and inspect ~/.bashrc.
  3. Ensure the standard guarded loader is present and uncommented:
# enable bash completion in interactive shells
if ! shopt -oq posix; then
  if [ -f /usr/share/bash-completion/bash_completion ]; then
    . /usr/share/bash-completion/bash_completion
  elif [ -f /etc/bash_completion ]; then
    . /etc/bash_completion
  fi
fi
  1. Apply the change without closing the terminal:
    source ~/.bashrc
  2. Alternatively, close the terminal and open a new one. A new interactive shell reads the startup files again.

Ubuntu’s package index describes bash-completion as “programmable completion for the bash shell.” It adds completion definitions for many commands, their options, and their arguments. The exact commands covered depend on the completion definitions installed by the package and by other software on your system.

#1 Best Overall
Sale
Gaoye Blue Light Blocking Glasses
  • BLUE LIGHT BLOCKING GLASSES: Our blue light glasses for women boast UV400 protection, blocking harmful blue rays from computer screens. With these bluelight glasses women, you can enjoy gaming, reading, or watching TV with no worries of eye strain.
  • EYE RELIEF: Our blue light glasses are engineered to reduce blurry vision or strain caused by prolonged screen time. These womens blue light glasses aid in better sleep by preventing blue light from disrupting your natural sleep cycle, helping you fall asleep faster and enjoy a more restful night's sleep, making them the perfect christmas present.
  • COMFORTABLE: Crafted from durable material, our trendy blue light glasses for woman or blue light glasses men ensure long-lasting comfort. The high-transmittance lenses accessories, gamer gifts for men, help keep your eyes relaxed. Perfect stocking stuffers, gifts for gamers men, christmas gifts for men, halloween costumes.
  • LIGHTWEIGHT: These clear blue light glasses feature a lightweight frame, meaning they’ll stay comfy for long-term wear. Perfect as blue blockers glasses for women or mens blue light glasses, these non-prescription fake glasses for men can be worn throughout the day. The blue light blocking glasses women feature polycarbonate HD lenses, which are anti-reflective and restore true color.
  • WORRY-FREE PURCHASE: If you experience any issues, our support team is ready to assist you quickly. These are the perfect costume glasses for cosplay dressing up.

What Bash completion changes

Bash has built-in completion behavior. Pressing Tab can complete a path or filename from the current directory even when no programmable completion package is loaded. Programmable completion extends that behavior with command-aware rules.

  • Filename completion: Bash searches names that match what you have typed, such as Documents/ or notes.txt.
  • Command completion: a completion definition can suggest executable commands or subcommands.
  • Option completion: a definition can offer switches appropriate to the command, rather than every file in the directory.
  • Argument completion: a definition can suggest values such as users, services, branches, devices, or other command-specific arguments when the command provides rules for them.

Completion is context-sensitive. A command may have no specialized definition, or a particular argument may intentionally fall back to filename completion. That does not necessarily indicate a broken installation.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Per-user setup, step by step

1. Confirm that you are using Bash

The procedure assumes Bash. Check the configured login shell with:

echo "$SHELL"

A path ending in /bash normally indicates Bash. A user can also start a different shell inside a Bash terminal, so check the shell in the session where completion fails. If you need an additional check, Bash exposes its version in $BASH_VERSION; an empty value means the current process is not Bash.

2. Install the distribution package

Use Ubuntu’s package manager rather than downloading a completion script from an unrelated site:

sudo apt update
sudo apt install bash-completion

apt update refreshes package metadata. apt install installs the distribution-managed package and its files. You need an account allowed to use sudo, or an administrator must perform the installation.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #2
Windex Gaming Cleaning Wipes, Pre-Moistened Wipes to Instantly Clean all Gaming Gear and Electronics, Resealable Packaging for a Freshness Lock, 25 count (Pack of 1)
  • WINDEX GAMING WIPES: effortlessly clean all your gaming gear and gaming electronics in one easy step with our new Windex Gaming Wipes
  • AMMONIA FREE: our ammonia-free formula is safe to use on all of your favorite gaming equipment like consoles, headsets, controllers, screens, keyboards, and more
  • PRE-MOISTENED WIPES: each wipe instantly removes dust, dirt, and stubborn smudges and fingerprints leaving a streak-free shine
  • ANTI-STATIC: great for cleaning and wiping down your gaming gear and electronics leaving behind no visible residue
  • COMPACT RESEALABLE PACKAGE: store your pack of Windex Gaming Wipes anywhere in your home for whenever a quick and easy wipedown is needed

3. Inspect ~/.bashrc

Interactive non-login Bash sessions, including most terminal windows, commonly read ~/.bashrc. Open it with an editor, for example:

nano ~/.bashrc

Look for the guarded block shown below. Ubuntu releases and images do not all activate completion in exactly the same place, so do not add a second competing loader if an equivalent active block is already present.

# enable bash completion in interactive shells
if ! shopt -oq posix; then
  if [ -f /usr/share/bash-completion/bash_completion ]; then
    . /usr/share/bash-completion/bash_completion
  elif [ -f /etc/bash_completion ]; then
    . /etc/bash_completion
  fi
fi

If every line is prefixed with #, remove the comment markers from this block. If it is absent, add one copy near the other interactive-shell settings. The two file tests make the setup work with either of the common loader locations: the package path under /usr/share or the older fallback at /etc/bash_completion.

4. Understand the guard before changing it

  • if ! shopt -oq posix; then prevents the loader from running when Bash is operating in POSIX mode.
  • [ -f /usr/share/bash-completion/bash_completion ] tests the primary loader path.
  • The elif checks /etc/bash_completion as a fallback.
  • The leading dot (.) reads the loader into the current shell; it is equivalent to source.

Keep this structure intact. Removing the guard can make non-interactive or incompatible shell contexts load completion unnecessarily, while hard-coding only one path can fail on an image that uses the other path.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

5. Reload the current shell

Changes to ~/.bashrc do not retroactively alter the shell that is already running until you read the file again:

source ~/.bashrc

If the command prints an error, note the first failing line; a syntax error elsewhere in ~/.bashrc can stop later startup commands from running. Opening a new terminal is another way to start a fresh interactive shell. Ubuntu’s documentation for a Bash completion generator specifically notes that persistent completion setup requires starting a new shell.

Rank #3
Sale
LISEN Cell Phone Stand Phone Holder for Desk, Office Decor Gadgets for Men
  • Ergonomic & Adjustable Design: Fight "text neck" and improve your posture. Designed for comfort, it offers an adjustable height (7.1in-8.5in) (1.4in adjustable range) and angle (5°-85°) Please note: cell phone stand is only 9 inches tall—the length of a standard pencil
  • Without blocking subtitles Perfect for office desk Tiktok Face Time Zoom video—this is the ultimate kitchen desk essential for phones! Perfect viewing experience while reducing neck back strain, A must-have for gamers streamers desk, and anyone who values both style and support!
  • Sleek & Stable Design fits Otterbox Case: Say goodbye to bent cables, tangles, and tip-overs! LISEN’s stylish adjustable desk phone holder features a built-in charging hole and smart cable management, keeping your phone secure and your workspace clutter-free cool gadgets for men
  • ANTI-SLIP DESIGN free hands: The under 10.00 items easy gadgets back and the bottom of this kitchen essentials for women are fully covered by anti-skid silicone, which LISEN stand up desk decor can provide maximum protection device from any scratches and slides
  • Your Perfect Viewing Companion:If your product arrives damaged or breaks within 365 days, reach out to LISEN for a quick and hassle-free solution. Struggling with assembly, like tightening the screw? We’ve got your back! Your experience matters to us. (Product including: phone Holder stand*1, screw*1, hexagon screwdriver*1, specification*1)

How do I turn on bash completion for every new user?

There are two separate goals: enable completion for existing accounts and make the default configuration available when future accounts are created. A system-wide startup file addresses the first goal for Bash sessions that read it. The skeleton directory and account-provisioning files address the second.

System-wide interactive Bash configuration

Ubuntu commonly provides a system-wide interactive Bash startup file at /etc/bash.bashrc. Some images use a profile script that loads the completion setup instead. Inspect the release you deploy before editing; historical Ubuntu configurations have used paths such as /etc/profile.d/bash_completion.sh, /etc/skel/.bashrc, and sections of /etc/bash.bashrc, and those defaults have changed.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  1. Check whether the loader exists:
    ls -l /usr/share/bash-completion/bash_completion /etc/bash_completion
  2. Open the system-wide interactive file with administrative privileges, for example:
    sudoedit /etc/bash.bashrc
  3. Place the same guarded block in the file that the target Ubuntu image actually loads. Keep one active copy in the appropriate startup path.
  4. Save the file and start a new Bash session for testing. Existing shells do not automatically re-read a changed system file.
  5. Test with an ordinary user account, not only with the administrator account. A system-wide change should be usable without requiring each user to edit a personal file.

The upstream project’s guidance is that, depending on the package, you may still need to source completion from /etc/bashrc, ~/.bashrc, or another file that sources one of them. Ubuntu uses its own startup-file layout, so follow the files actually loaded by your image rather than copying a path from a different distribution.

Provisioning future accounts with the skeleton directory

When the objective is “every new user,” inspect /etc/skel and the account-creation process used by your Ubuntu image. A file copied from the skeleton into a new home directory can provide a personal ~/.bashrc, but it does not alter accounts that already exist. Existing users need the system-wide startup path, an individual update, or both, depending on your policy.

Before changing a skeleton file, determine whether your provisioning tool replaces it, merges it, or supplies its own dotfiles. Keep the guarded loader so accounts that run Bash in an incompatible mode do not source it. After creating a test account, start a new interactive Bash session and verify completion as that user.

Per-user and system-wide approaches compared

Approach Who it affects Where it is configured How it becomes active Main trade-off
Per-user package and dotfile One existing account ~/.bashrc source ~/.bashrc or a new terminal Least disruptive, but every account must be maintained separately
System-wide interactive setup Users whose Bash sessions load the configured system file Commonly /etc/bash.bashrc or a release-specific profile script New Bash sessions; current shells must be reloaded Central administration, but a mistake affects many users
Skeleton configuration Accounts created after the change Typically /etc/skel/.bashrc, subject to the image’s provisioning rules When the new home directory is created, then on its first new shell Useful for future accounts, not a retrofit for existing homes
Hand-written completion script Only commands covered by that script A custom file sourced by Bash After its source line runs in a new or reloaded shell More maintenance and a risk of conflicts; package-managed definitions are preferable when available
Other shells Users running zsh, fish, or another shell That shell’s own completion configuration According to that shell’s startup rules The Bash loader is not a universal completion system

Why does Tab complete filenames but not command options?

This symptom usually means Bash’s basic filename completion is working but programmable completion has not been loaded, or the command has no completion definition for the context you tried.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #4
Ledagic IC+RGBW USB Powered Led Light Bar with App & Remote Control, 2 Pack
  • Easy Installation: Our gaming lights have been designed to enhance your entertainment experience. Simply position the led light bar next to your TV or game console to create a game room environment with ease. They come with USB power and a 60 inch cord for direct mounting and mobility
  • Audio Syncing & Extensive Mode: The built-in high-sensitivity music sensor allows you to sync the TV led lights to your favorite music. Lights react and move to the beat of music, film and game audio, creating an incredible immersive sound and light experience – and all without the need for an additional hub. You can choose from 64+ patterns, including strobe, illusion, jump, energy, gradient, running, chasing, fluttering mode etc. Each mode can be applied to different scenes
  • 64+ Chasing IC+RGB & W Effect: The independent control design of IC+RGB and white all-in-one multifunctional rgbw led bar lights monitor backlight allows you to easily switch the led lights for desk between IC+RGB and white to enjoy a variety of lighting effects, you can choose white lighting mode with high brightness for better illumination when working, etc. Choose IC+RGB lighting mode when you need to create an entertaining atmosphere for the light show, 16 million colours of Color changing rgb light bar let you dance to the beat and create a dynamic party atmosphere
  • Dynamic and Dimmable Lights: 1%-full brightness free brightness adjustment gives you the flexibility to adjust dimmable led light bar for room decorations or a variety of occasions
  • USB Powered: USB light bars for room can be powered by powernank, usb charger, TV, Monitor, laptop PC mainframe, making behind TV led lighting bar easy to install in any location.TV led lights are powered by the TV usb interface / PC mainframe, can be turned on/off synchronously with TV / PC
  1. Check the package:
    dpkg -s bash-completion

    Look for a status indicating that the package is installed. You can also inspect the candidate and installed versions with:

    apt policy bash-completion
  2. Check the loader file:
    ls -l /usr/share/bash-completion/bash_completion

    If that path is missing, check the fallback:

    ls -l /etc/bash_completion
  3. Check the current shell:
    echo "$SHELL"
    printf '%sn' "$BASH_VERSION"

    If the session is not Bash, the Bash completion loader is the wrong configuration to troubleshoot.

  4. Check the startup block: make sure the guarded block is active in ~/.bashrc or in the system-wide interactive startup file used by your release.
  5. Reload or restart:
    source ~/.bashrc

    For a system-wide change, start a new terminal or a new Bash process after confirming that the file is read by that type of session.

Test more than one command. Completion definitions are command-specific, and a missing suggestion for one argument does not prove that the whole package failed.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Troubleshooting checklist for new Ubuntu users

“I installed the package, but nothing changed.”

Installation and activation are separate. Confirm that the loader exists and that an active startup block sources it. Then reload ~/.bashrc or open a new terminal. A package can be installed correctly while no startup file invokes it.

“The loader path is different on this Ubuntu image.”

Use the guarded two-path block instead of assuming only /usr/share/bash-completion/bash_completion exists. If neither file is present after installation, inspect the package status and the package manager’s error output before editing startup files.

Best Value
Sale
HUANUO FlowLift™ Dual Monitor Stand, Fully Adjustable Gaming Monitor Desk Mount for 13–32″ Computer Screens, Full Motion VESA 75x75/100x100 with C-Clamp & Grommet Base, Each Arm Holds 4.4 to 19.8 lbs
  • Compatible with Wide Screens - To ensure compatibility with the dual monitor mount, your each monitor must meet three conditions at the same time: First, computer screens size range: 13 to 32 inches. Second, screen weight range: 4.4 to 19.8 lbs. Third, the back of the monitor screen must have VESA mounting holes with a pitch of 75x75mm or 100x100mm.
  • Regarding the compatibility with desks - Your desk must meet three conditions at the same time: First, desk material: Only wooden desks are recommended, plastic or glass desks cannot be used. Second, desk thickness range: 0.59" - 3.54". Third, the bottom of the desk should not have any cross beams or panels, as this will interfere with installation. We recommend carefully checking that your desk and monitors meets all above conditions before purchasing.
  • Dual C-Clamp Hold - Worried your dual monitors might wobble or slip? Our upgraded base uses a larger platform plus a dual C-clamp structure to lock the dual monitor arm firmly to your desk. Each arm safely keeps your screens steady while you type, click and game—no shaking, no sliding, just a clean and secure setup you can trust every day. It also provides Grommet Mounting installation choice, both options ensure stable and secure fixation for your 0.59" - 3.54" desk.
  • Full-Motion Adjustment For Comfortable View - Pull the screen closer when you’re deep in a spreadsheet, push it back to watch videos, or rotate to portrait for coding — moving everything smoothly with just one hand. The monitor stand offers +85°/-50° tilt, ±90° swivel and 360° rotation. Raise your monitor up to 15.75″ to support a healthy sitting posture. Whether you’re working from home, gaming through the night, or switching between video calls and documents, getting the screens to your natural line of sight helps relieve neck, shoulder and back strain so you can stay focused longer with less fatigue.
  • Keep Your Desk Organized: By lifting both screens off the desktop, this dual monitor stand opens up valuable space for your keyboard, notebook, docking station or a simple, clutter-free work area. Built-in cable management guides wires along the arms, keeping cords out of sight and out of the way. Enjoy a tidy, modern workstation that looks as good as it feels to use.

“It works in one terminal but not another.”

Compare the shell and startup mode in each terminal. Interactive Bash sessions usually read ~/.bashrc, while login and non-interactive sessions can use different files or skip it. A terminal emulator, remote session, or script may therefore start a different kind of shell. Configure the file that the failing session actually loads; do not blindly source interactive completion from scripts.

“The completion block is present, but it is skipped.”

The first condition deliberately skips loading when Bash is in POSIX mode. Check whether that mode is enabled in the affected session. Also check for an earlier syntax error in ~/.bashrc or a profile file, because Bash stops processing a startup file when a command fails in a way that prevents later lines from being reached.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

“Options still do not complete for one command.”

Programmable completion is not a promise that every command or every option has a rule. The command may lack an installed definition, may use a custom interface, or may intentionally complete files for that argument. Check another command and review the command’s own documentation before replacing the global setup.

“A system-wide change did not affect an existing account.”

Start a new shell after editing the system file. If the account has a personal ~/.bashrc that overrides or bypasses the system configuration, inspect that file as well. Skeleton changes apply when homes are created; they do not rewrite existing users’ dotfiles.

“Completion broke after I added a custom script.”

Temporarily disable the custom source line, open a new Bash session, and test the package-managed setup alone. Hand-written scripts can override definitions, emit errors during startup, or assume a different Bash version. Reintroduce custom rules only after the base loader works.

Package-managed definitions versus hand-written scripts

Installing bash-completion keeps the core loader and its definitions under Ubuntu’s package management. Updates can add or correct rules without requiring every user to copy files manually. A hand-written completion script is appropriate when you administer a command that has no packaged definition, but it should be kept separate from the distribution loader and sourced deliberately.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  • Prefer the package for general command, option, and argument completion.
  • Use a custom script only for a specific command or workflow that needs it.
  • Keep custom files in an administrator-controlled location and document which startup file sources them.
  • Test custom rules after package upgrades and after changing Bash versions.

Bash-only behavior and other shells

The Ubuntu package is for Bash. If echo "$SHELL" identifies another shell, install or configure that shell’s own completion mechanism instead of sourcing the Bash loader into it. A user can have Bash as the login shell but still launch another shell interactively, so diagnose the process that is actually displaying the prompt.

A safe deployment sequence for administrators

  1. Identify the Ubuntu release or image used in production and inspect its Bash startup files.
  2. Install bash-completion through the package manager on a test system.
  3. Verify the loader path and preserve the guarded conditional.
  4. Decide whether the policy is per-user, system-wide, future-users-only, or a combination.
  5. Apply the system-wide change with an administrative editor, then create a test account if future-user behavior matters.
  6. Open a new interactive Bash session as both an existing and a newly created user.
  7. Test filename completion and command-aware option or argument completion separately.
  8. Record the startup file used by that Ubuntu image so future upgrades can be checked rather than assumed.

What success looks like

In a fresh Bash terminal, pressing Tab should still complete ordinary paths. For commands that have programmable definitions, the same key should offer context-appropriate commands, options, or arguments. The package is installed, the loader file exists, the guarded block is active in the startup path used by the session, and a reload or new shell has occurred. If those checks pass but one command remains unable to complete options, the remaining limitation is likely that command’s completion definition rather than Ubuntu’s global activation.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More quests from Patch Notes

  1. How to Set Up a RedM (RDR2) Server in 2026: License Key, txAdmin and server.cfg, Step by StepBlog11min
  2. Best RedM (RDR2) Server Hosting in 2026: Comparing Four Hosts on Slots, Memory and PriceBlog10min
  3. How to Host a Mindustry Server in 2026: server-release.jar, Port 6567 and the Commands That MatterBlog7min
Recommended PC Tool
Recommended PC Tool
PC Slower Than It Used to Be?Free scan - under a minute
Outdated Drivers Are Slowing You DownFree scan - exact matches

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.