≡ Menu

ksh

FreeBSD Change User Password Shell Script

How do I change user password using a shell script under FreeBSD operating systems?
[click to continue…]

KSH For Loop Examples

Q. How do I use for loop in Korn Shell under UNIX / Linux / BSD / OS X operating systems?
[click to continue…]

tmout on a Linux/Unix shell
How can I configure the bash or ksh shell to logout any user automatically after a period of idle time under a Debian Linux or any other UNIX-like operating system?
[click to continue…]

KSH IF Command Conditional Scripting Examples

How do I use if command with KSH to make decisions on Unix like operating systems?
[click to continue…]

Understanding command line shell

Q. I’ve migrated from Windows NT to Linux workstation. Most documents refer to a command line shell. Can you explain me command line shell?

A. A shell allows you to type the commands such as date or clear. There are many shell available. BASH (bourne again shell) is default shell for most Linux distributions.

It also known as a command interpreter which takes command from user and pass the same to kernel for execution. Bash shell supports aliases, filename completion, command history, POSIX compatibility and many other features.

Other UNIX / Linux shell

  • csh / tcsh
  • sh / ksh

How do I find the largest top files and directories on a Linux or Unix like operating systems?
[click to continue…]

Howto: Changing Linux Login Shell

Q. Can you tell me command to change login shell in Linux / UNIX operating system?

A. You don't have to edit /etc/passwd file to change your shell. You need to use chsh command. It changes the user login shell. This determines the name of the users initial login command. A normal user may only change the login shell for his/her own account, the super user i.e. root user may change the login shell for any account. Following is syntax of chsh command:
chsh -s {shell-name} {user-name}

Where,

  • -s {shell-name} : Specify your login shell name. You can obtained list of avialble shell from /etc/shells file.
  • User-name: It is optional, useful if you are a root user.

First, find out available shell list:
$ less /etc/shells

Output:

/bin/ash
/bin/csh
/bin/sh
/usr/bin/es
/bin/ksh
/bin/tcsh
/bin/sash
/bin/zsh
/bin/dash
/usr/bin/screen
/bin/bash
/bin/rbash

Now change your shell name to /bin/tcsh:
$ chsh -s /bin/tcsh
Password:

When promoted for password, type your own password. If you just type chsh command, it will prompt for shell name interactively:
$ chsh

Output:

Password:
Changing the login shell for tv
Enter the new value, or press ENTER for the default
       Login Shell [/bin/bash]: