Thursday, June 28, 2012

command to know the current SHELL

Here are some of the commands to view the current shell


[root@tester]# rpm -query bash
bash-3.0-19.2
[root@tester]# ps -p $$
  PID TTY          TIME CMD
10532 pts/2    00:00:00 bash

[root@tester]# ps $$
  PID TTY      STAT   TIME COMMAND
10532 pts/2    S      0:00 bash


[root@tester ~]# echo $0
-bash

with version you can check with the following command

[root@tester]# rpm -qi bash
Name        : bash                         Relocations: /usr
Version     : 3.0                               Vendor: Red Hat, Inc.
Release     : 19.2                          Build Date: Tue 07 Dec 2004 04:17:36 AM IST
Install Date: Wed 13 Jun 2012 11:03:54 AM IST      Build Host: porky.build.redhat.com
Group       : System Environment/Shells     Source RPM: bash-3.0-19.2.src.rpm
Size        : 5113068                          License: GPL
Signature   : DSA/SHA1, Thu 06 Jan 2005 02:16:34 AM IST, Key ID 219180cddb42a60e
Packager    : Red Hat, Inc. <http://bugzilla.redhat.com/bugzilla>
Summary     : The GNU Bourne Again shell (bash).
Description :
The GNU project Bourne Again shell (bash) is a shell or command
language interpreter that is compatible with the Bourne shell
(sh). Bash incorporates useful features from the Korn shell (ksh) and
the C shell (csh) and most sh scripts can be run by bash without
modification. Bash is the default shell for Red Hat Linux.




root@tester]# which bash
/bin/bash

you can also check with useradd -D command for user default shell


To view  all the enabled shell you can use

[root@tester]# cat /etc/shells
/bin/sh
/bin/bash
/sbin/nologin
/bin/ash
/bin/bsh
/bin/ksh
/usr/bin/ksh
/usr/bin/pdksh
/bin/tcsh
/bin/csh
/bin/zsh

No comments: