/ factorpad.com / tech / linux-essentials / chsh-command.html
An ad-free and cookie-free website.
Beginner
Learn to change shell programs at the Linux command line.
Videos can also be accessed from the Linux Essentials Playlist on YouTube.
Linux chsh Command Summary with Examples (3:23)
Our sixty-first word, or command to memorize is
chsh
from our category
System.
chsh
allows you to change login shell
programs.
-options | description |
---|---|
-h ,
--help |
Display help screen |
-s ,
--shell SHELL_PATH |
Select the new SHELL_PATH to program for login |
Recall from back in video 10 on
cat
, we viewed a file listing shell
programs available on the system? Here, we'll explore that further.
Before we start, it helps to think of commands as mini programs and
most follow this structure:
command -option(s) argument(s)
.
The chsh
command has
3 options and the argument is the user you'd like the
change to apply to, if you're an administrator, or the path to the
login shell program.
Like most commands, help is available with double-dash
--help
. The
-s
option followed by the full path
to the shell program is what is required. While this is more of an
administrator-level program, I wanted to mention it because it
illustrates a point. We've been using the
bash
shell throughout, but others are
available.
So why is chsh
an important command?
Well, the Linux operating system is very flexible and offers each user
the ability to choose her own shell program.
And now you know how to do that.
Okay, the best way to embed this in your memory is by typing in your own terminal window.
Find this on your Mac using a program called Terminal. On Linux use Terminal or Konsole, and currently Microsoft is adding this functionality to Windows.
Here we go. So let's look at that line from video 10, where we used
cat
to print a file called
/etc/shells
.
And here, on my system at least, I have five choices:
sh
,
dash
,
bash
, which we've been using,
rbash
, and
tmux
.
So a discussion of the pros and cons of each one is beyond our scope here and last, since we haven't covered permissions yet, I'm reluctant to dive in any deeper at this time, so consider this an easy session.
Very good.
Okay now you know how to use chsh
.
And you know the syntax for commands, options and arguments.
One last tip about the chsh
command. So Wikipedia offers a good comparison of shell programs, so
there's a link in the Description (YouTube).
Okay, thanks for visiting today. I hope this was a helpful
introduction to the chsh
command.
For an overview of the 100 videos, the 8 quizzes, a cheat sheet, the categories and a Q&A section, visit:
This was a short Terminal session, but they get longer and more difficult, especially as we approach shell scripting. Subscribe at YouTube to catch new videos.
bg
command,
hit Back.uname
command, click Next./ factorpad.com / tech / linux-essentials / chsh-command.html
A newly-updated free resource. Connect and refer a friend today.