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

Windows 10 1903 Critical Error: Your Start menu isn't working

Windows 10 1903 Critical Error: Your Start menu isn't working. We'll try to fix it the next time you sign in.

[PowerShell]: Powershell script uploading backup databases to ftp server

Author:  Enrique Puig Nouselles http://gallery.technet.microsoft.com/scriptcenter/80647f66-139c-40a4-bb7a-04a2d73d423c Nhu cầu - Học sử dụng Powershell và áp dụng vào thực tế - Server chạy MS SQL được backup mỗi ngày và lưu các file backup ở folder mặc định "C:/Program Files/Microsoft SQL Server/MSSQL11.MSSQLSERVER/MSSQL/Backup" - Upload các file database backup về một ftp server khác để lưu "offsite" # Begin script # Thanks to: Enrique Puig Nouselles http://gallery.technet.microsoft.com/scriptcenter/80647f66-139c-40a4-bb7a-04a2d73d423c # Khai báo folder chứa các file backup database, dưới đây là folder backup mặc định của MS SQL 2012 $Dir="C:/Program Files/Microsoft SQL Server/MSSQL11.MSSQLSERVER/MSSQL/Backup"   # ftp server $ftp = "ftp://IPAddres/subfolder/subsubfolder" $user = "usernamehere" $pass = "passwordhere" # DO NOT use $(Get-Date), use $d variable instead, otherwise SQL Agent gets error "The...