• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer navigation

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • Solaris
    • Oracle Linux
    • VCS
  • Interview Questions
  • Database
    • oracle
    • oracle 12c
    • ASM
    • mysql
    • MariaDB
  • DevOps
    • Docker
    • Shell Scripting
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

chsh Command Examples in Linux

by admin

The chsh (change shell) command sets your login shell program. Invoked without a username, chsh affects your account; invoked with a username (by root), it affects that user. With no options, chsh will prompt you for the desired information.

$ chsh
Changing shell for smith.
Password: *******
New shell [/bin/bash]: /bin/tcsh

The new shell must be listed in /etc/shells.

chsh Command Examples

1. To change your login shell:

# chsh -s /bin/bash 

2. To print the list of shells:

# chsh -l 

3. To print the usage message and exit:

# chsh -u

4. To print the version information:

# chsh -v 

Tips

– After changing shells, you might have problems running some commands or have a prompt or display that’s not as good as the original. That’s likely a result of your default shell being carefully customized by your system administrator.
– Some systems don’t let users use chsh to change shells. If this is the case, you’ll need to email your system administrator and ask for a change, or see if there are alternative methods.

Final Thoughts

chsh is used to change your login shell. If a shell is not given on the command line, chsh prompts for one. All valid shells are listed in the /etc/shells file. For example:

$ chsh -l
/bin/bash
/bin/sh
/bin/ash
/bin/bsh
/bin/tcsh
/bin/csh
/bin/ksh
/bin/zsh

Filed Under: Linux

Some more articles you might also be interested in …

  1. touch Command Examples in Linux
  2. chage: command not found
  3. How to disable NetworkManager on CentOS / RHEL 7
  4. How to Disable IPv6 on Ubuntu 20.04 Focal Fossa
  5. xargs Command Examples in Linux
  6. How to Stop SSH Session From Getting Timed Out
  7. dpkg-query: command not found
  8. CentOS / RHEL 7 : How to set udev rules for ASM on multipath disks
  9. “iscsiadm” Discovery TimeOut With Two Or More Network Interfaces in CentOS/RHEL
  10. ldd: command not found

You May Also Like

Primary Sidebar

Recent Posts

  • qsub Command Examples in Linux
  • qsub: command not found
  • qrcp Command Examples in Linux
  • qmrestore Command Examples in Linux

© 2023 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright