How To Set Your Linux Command Shell

Linux Shell

One of the best things about the Linux command line is the ability to recall the last used command by hitting the up arrow ↑. Yes, I realize that Windows command line has done that for a long time, but where do you think they got the idea for that?

I’m fairly new to this whole Linux thing and I had an issue where I used SSH to get to a Linux server but when I ran a command and then hit the up arrow ↑, I got back a couple unreadable characters instead of the previous command. I found out that I was using the wrong command shell for what I was wanting to do.

There are a few shells that seem to be fairly common:

  • bash – Bourne again shell
  • ksh – Korn shell
  • csh – C Shell
  • dash – Debian almquist shell

I’m not sure which shell I was using that day, but I figured out that I needed the bash shell. Below are a few commands that will help you when working with your command shell:

  • To find all of the available shells in your system, type the following command:
    cat /etc/shells
  • To find out your current shell, type any of the following commands:
    echo $SHELL
    ps $$
    ps -p $$
  • To change your shell to the bash shell, type the following command:
    chsh -s /bin/bash

Anything else you want to add to the discussion about shells?

 

Leave a Reply