The Linux Shell cannot be complete by pressing the TAB key

Source: Internet
Author: User

Today, I have a problem. The parameters behind git are tab-key, such as Git c_

Search the internet for half a day to find the answer as follows

Today in Linux with Useradd new users, found that the use of new users when landing, in the shell can not use the TAB key to complete the command, press the up and down keys can not switch historical commands, garbled phenomenon. The root user is OK.

Later found that in/etc/passwd, the new user shell and the root user is not the same.

Root uses/bin/bash.

New user By default is/bin/sh

Found with Ls-l/bin/sh

/bin/sh-/bin/dash

Dash and bash are not the same, after changing the/bin/sh to/bin/bash,

Run sudo on my Ubuntu gedit/etc/passwd results The following can also be viewed with the env command shell=/bin/bash/

Hailongzhou:x:1000:1000:hailongzhou,,,:/home/hailongzhou:/bin/bash
The user's shell is really bash but/bin/sh-/bin/dash

Modify the default connection for Ubuntu/bin/sh: terminal input: [email protected]:~# cd/bin[email protected]:/bin# ls-l/bin/shlrwxrwxrwx 1 root root 4 2008- 04-28 19:59/bin/sh, Dash//default bit dash[email protected]:/bin# ln-sf bash/bin/sh//Soft link-f means force [email protected]:/ bin# ls-l/bin/sh

lrwxrwxrwx 1 root root 4 2008-05-01 22:51/bin/sh bash//Now Bash

The parameters behind git can be filled with the TAB key.


The difference between bash and dash
Bash-gnu Bourne-again SHell
Dash-debian Almquist Shell
You can look at the man Bash/man Dash separately.

So how do you change sh to point to bash?
The most violent approach, of course, is to change/bin/sh's soft links directly into bash,
such as: Ln-s/bin/bash/bin/sh
However, there are some elegant methods,
sudo dpkg-reconfigure Dash
When the menu asks you if you want to dash, you can choose No.
To check again, Ls/bin/sh-al found that the soft link points to/bin/bash.

The Linux Shell cannot be complete by pressing the TAB key

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.