What Is sh Shell In Linux?

Linux is a command-line operating system. As a command-line or shell-based operating system, it provides a different shell in order to use, manage and execute commands. The sh is a popular term and shortcut used to describe the Bourne shell in Linux. Bourne shell is a very simple shell that is provided with most of the Linux distributions.

/bin/sh File

The sh shell is located under the binary folder /bin with the name of “sh”. It can be easily started by using the following absolute path and execution.

/bin/sh

In some distributions, the sh is not a real file which is actually a symbolic link to another binary that provides the Bourne Shell. For example, in Ubuntu, the sh is linked to /bin/dash binary.

/bin/sh: symbolic link to dash

/bin/sh Shell

The dash is a new implementation of the Bourne shell which provides basic Bash features. It is generally used in constrained systems to provide basic shell functionality. The sh can be started like below. We can see that the shell prompts changes that are simpler than Bash.

/bin/sh

“sh -” Usage

The “sh -” is used to read the shell from standard input. The – dash expresses that the newly created shell read from the standard input. This is generally used to read redirected content by using a pipe. For example, in the following example the date command output is redirected into the sh shell as input.

echo date | sh -
See also  Linux /etc/passwd File

Leave a Comment