Checking Bash is running

If you're using a GNU/Linux system, and your system administrator hasn't changed your login shell, it's likely that Bash is starting up as soon as you log in with a TTY, in an xterm, or over SSH.

If you see a prompt that looks like one of these after you log in, it's a good sign you're in a bash session:

bash-4.4$
user@hostname:~$

If you want to check, you can enter this at the prompt:

bash$ declare -p BASH

If you get a response like this, with a path to your bash binary, you can be confident you are running bash:

declare -- BASH="/bin/bash"

If you get some other output, such as:

sh: declare: not found

Then you may be running some other kind of shell. You may be able to tell what it is by printing the value of the ...

Get Bash Quick Start Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.