# Linux: Shell Appearance

If you ever log into a linux host, and the command prompt has only a '$', and there is no scrollable command history, then the shell may not be set to bash.

#### Shell Assignment

You can check what shell is assigned to the user with this:

```bash
getent passwd username
```

You will see something like this:

```

username:x:1001:1001::/home/username:/bin/bash
```

If the shell is something like `/usr/sbin/nologin`, `/bin/sh`, or blank, change it to bash:

```bash
sudo chsh -s /bin/bash username
```

Then, log out and back in, and you will have a bash shell.

#### Not Launching Interactively

SSH by default starts a **non-login shell**, and some files like `.bashrc` or `.bash_profile` may be missing.

To correct this, ensure the following files exist in the user's home directory:

```bash
# Copy default skeleton files to get a usable shell config
sudo cp /etc/skel/.bashrc /home/username/
sudo cp /etc/skel/.profile /home/username/
sudo chown username:username /home/username/.bashrc /home/username/.profile
```

#### Home Directory Permissions

If that doesn't fix it, the user's home directory may have weird permissions.

To fix that, run these:

```
sudo chown -R username:username /home/username
sudo chmod 755 /home/username
```

#### Bash History

Bash normally writes to ~/.bash\_history.

If Bash history is not being saved on exit, you can fix it with this:

```bash
sudo touch /home/username/.bash_history
sudo chown username:username /home/username/.bash_history
chmod 600 /home/username/.bash_history
```

Also. Make sure the history file is not disabled, with this:

```bash
echo $HISTFILE
# Should output something like /home/username/.bash_history
```