In the GNOME Terminal, Bash does smart auto-completion. For example
apt-get in
becomes
apt-get install
>
I don't know the answer to this. But the reason that it doesn't work as you expect is probably because the completion in emacs shells is handled by emacs internally (by the comint-dynamic-complete function), and doesn't have those smart completion functions built-in.
I'm afraid it is not an easy thing to fix.
Edit: njsf's suggestion of using term-mode is probably as good as it gets. Start it with
M-x termIt is included in the standard emacs distribution (and in emacs21-common or emacs22-common on Ubuntu and Debian at least).