Skip to main content

Linux command: Check Current Shell

Ways to find out current linux shell

What is your current shell?

Ways to find current shell.

echo SHELL variable

$ echo $SHELL
/bin/sh
red-stone-one-carat% echo $SHELL
/bin/rzsh
red-stone-one-carat%
$ echo $0
/bin/sh

Look for SHELL variable when run env command

$ env
MAIL=/var/mail/learnlinuxfree
USER=learnlinuxfree
SSH_CLIENT=58.187.170.49 6126 22
HOME=/home/learnlinuxfree
SSH_TTY=/dev/pts/2
LOGNAME=learnlinuxfree
TERM=xterm
XDG_SESSION_ID=9760
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games
XDG_RUNTIME_DIR=/run/user/1002
LANG=en_US.UTF-8
SHELL=/bin/sh
PWD=/home/learnlinuxfree
SSH_CONNECTION=58.187.170.49 6126 173.82.240.78 22

List of available shells on a system

$ cat /etc/shells
# /etc/shells: valid login shells
/bin/sh
/bin/dash
/bin/bash
/bin/rbash
/usr/bin/tmux

Change default shell for user

root@3:~# which usermod
/usr/sbin/usermod
root@3:~# usermod --shell /bin/bash tuyendq
root@3:~# 

List of common shells

  • /bin/sh — Bourn shell
  • /bin/bash — Bourn Again shell

Popular posts from this blog

Check and install php7.0-mbstring extention on Ubuntu 16.04 and Microsoft Windows

While learning Facebook SDK for PHP I overlooked one of system requirements preventing my code from running on my host. That is The mbstring extension. Facebook SDK for PHP's system requirements Check if mbstring is enabled root@ubuntu001:~# php -a Interactive mode enabled php > echo extension_loaded('mbstring'); php >exit root@ubuntu001:~# apt-cache search php7 | grep mbstring php7.0-mbstring - MBSTRING module for PHP root@ubuntu001:~# Install php7.0-mbstring root@ubuntu001:~# apt-get install php7.0-mbstring Reading package lists... Done Building dependency tree Reading state information... Done The following packages were automatically installed and are no longer required:   fontconfig-config fonts-dejavu-core libfontconfig1 libgd3 libjbig0   libjpeg-turbo8 libjpeg8 libmcrypt4 libtiff5 libvpx3 libxpm4 Use 'apt autoremove' to remove them. The following additional packages will be installed:   libapache2-mod-php7.0 php7.0-cli ph...

Demistify Buffer Overflow Vulnerability

Collection of articles, blog posts, lectures, tutorials... about Buffer Overflow Vulnerability.

Powershell: Test-NetConnection

PS C:\Users\tuyen> get-help Test-NetConnection NAME     Test-NetConnection SYNTAX     Test-NetConnection [[-ComputerName] <string>] [-TraceRoute] [-Hops <int>] [-InformationLevel {Quiet |     Detailed}]  [<CommonParameters>]     Test-NetConnection [[-ComputerName] <string>] [-CommonTCPPort] {HTTP | RDP | SMB | WINRM}     [-InformationLevel {Quiet | Detailed}]  [<CommonParameters>]     Test-NetConnection [[-ComputerName] <string>] -Port <int> [-InformationLevel {Quiet | Detailed}]     [<CommonParameters>]     Test-NetConnection [[-ComputerName] <string>] -DiagnoseRouting [-ConstrainSourceAddress <string>]     [-ConstrainInterface <uint32>] [-InformationLevel {Quiet | Detailed}]  [<CommonParameters>] ALIASES     TNC REMARKS     Get-Help cannot find the Help files fo...