Bash tab completion can make esoteric, complicated commandline programs much easier to use, but it must be consistent. Currently Ubuntu has a lot of tab completion enabled, but some commands are inconsistent with others. On the same vein, there are a lot of little things that can be done with command-not-found that will make it even better at helping users find the best program, not just a program.

Release Note

The command-not-found functionality has been enhanced by adding "preferred" choices to some common, deprecated choices such as traceroute (prefer tracepath) or screen (prefer byobu).

Bash command line tab completion has been reviewed for consistency and quality of results so that it assists, rather than hinders, both the novice and advanced command line user. Many packages have had their tab completion updated to work in a more consistent way with commands that lack the functionality.

A hook has been added to bash tab completion which will offer to automatically help the user file a bug report in the package containing the command one is trying to complete arguments for if the user gets no completion results more than 5 times.


The command line user friendliness is something mentioned quite often to me by software developers as a hallmark of Ubuntu. However, as people gain experience with the system, they sometimes are frustrated with the little things that helped them in the beginning. Also long time Unix and Linux users are downright annoyed at the inconsistency of some of the tools.

Its important that the tool remain consistent as it grows with the user, so that is the main focus of this specification. Its also important that the quality of results remains very high.

User stories

As a new Ubuntu Server user I want to be told the best command to run given the command line I've typed and/or submitted to the command shell.

As an experienced system administrator, I want bash tab completion to work in a consistent, predictable way so that I do not get frustrated when bash tab completion fails while trying to construct a complicated command line.

As an Ubuntu command line user, I want to be able to help the Ubuntu project by reporting bugs when bash tab completion does not function properly.


  • apport can be easily plugged in to bash tab completion without modifying bash (just modifying the tab completion specifications)
  • command-not-found already has some functionality to enable preferred commands to be specified in the package


Bash Tab Completion

Review of all bash tab completion

A review of all bash tab completion should be done to look for obvious problems and inconsistencies. This includes not falling back to file name completion when appropriate (sqlite3), and not implementing all of the command line options contained in the usage message.

Develop test scripts

A set of test scripts should be fairly simple to develop which feed command lines into all tab completion scripts and report on their consistency with expected behaviors.

Publish best practices

While reviewing a set of best practices should be developed for writing bash tab completion scripts.

Review best practices

Any documentation that suggests that people add tab completion to their packages should be reviewed and updated to reflect the best practices developed during the review.

Apport Hook

An apport hook should be added to the bash tab completion process when tab is pressed more than 5 times (user testing may suggest higher or lower numbers). When this apport hook fires, the command line, and the package containing the command being typed, would be fed into apport.

Command Not Found

Create a list of preferred commands

In conjunction with the community, develop a list of deprecated commands and the preferred replacements for them. These should be added to the command-not-found database.


See Work Items in blueprint white board.

Test/Demo Plan

Bash Completion

The test scripts developed will be run as part of the qa-regression-tests suite to make sure the behavior remains consistent.



Unresolved issues

  • There is some need to tie together the information from command-not-found, man/apropos, and trusted web sites in a smooth way from the command line. DustinKirkland has proposed a tool called "q" that would do this, but it is outside the scope of this spec.


ServerTeam/Specs/Natty/CommandLineUserfriendly (last edited 2010-11-17 17:28:15 by 76-216-240-245)