I'm really new to using terminal and I've been following guide blindly without knowing why is that there and what does it do..though this guides help me in installing the vmware player.

this one worked for me since making the file executable, clicking the file, and run..only say root access is needed.

sudo sh vmwareplayer.txt (renamed it to be shorter)

Somehow I know what sudo does but what does sh do? Without it it goes "vmwareplayer.txt not found". And for bundle files why does it end with .txt?

  • It is a language interpreter
    – Tachyons
    Commented Mar 3, 2013 at 17:19
  • @Tachyons If you know the answer to the question, explain it in more detail and post it as an answer! :)
    – Alvar
    Commented Mar 3, 2013 at 17:27
  • See also a related question with answers explaining in great depth about interpreters (such as sh, bash) and shebangs, etc.
    – user76204
    Commented Mar 3, 2013 at 18:55
  • 1
    @Mik This is not a duplicate of that question. This is asking what sh does in a command that invokes a script. That question is about how a #! works inside a script file. Totally different. Commented Mar 4, 2013 at 9:13
  • @EliahKagan Yes, I was probably too hasty to cite it as a duplicate: I should have put 'related, but not duplicate' when referring to the other answer. You are right as usual; if you want to ask a moderator to reopen that's fine. I've already voted to reopen.
    – user76204
    Commented Mar 4, 2013 at 18:13

5 Answers 5


sh stands for "shell" and shell is the old, Unix like command line interpreter. An interpreter is an program that executes specific instructions written in a programming or scripting language. So basically you say "Execute that file for me".

You must understand that Linux doesn't really look at the file extension in order to determine what the file (or program) is. So as long as the content of that file is written in a way that the sh interpreter understands, it will work. But just for the sake of readability, such files are normally given an .sh extension and I have no idea what the developer was thinking when he gave that file a .txt extension..


In Ubuntu, sh or /bin/sh just points to dash. sh is supposed to run default command interpreter, which is dash for Ubuntu.1 dash refers to Debian Almquist shell.

A shell is a command line interpreter for the system. There are several other shells like bash, csh, zsh etc. Here is a brief excerpt from man page of dash:

 The shell is a command that reads lines from either a file or the termi‐
 nal, interprets them, and generally executes other commands.  It is the
 program that is running when a user logs into the system (although a user
 can select a different shell with the chsh(1) command).  The shell imple‐
 ments a language that has flow control constructs, a macro facility that
 provides a variety of features in addition to data storage, along with
 built in history and line editing capabilities.  It incorporates many
 features to aid interactive use and has the advantage that the interpre‐
 tative language is common to both interactive and non-interactive use
 (shell scripts).  That is, commands can be typed directly to the running
 shell or can be put into a file and the file can be executed directly by
 the shell.

There are lot of tutorials about Linux shells, you can start with this Wikipedia Article.

Coming to your question, if you write sh file, dash executes file for you.

  • It' a good explanation what sh is, but not what it does in the specific question above.
    – NilsB
    Commented Mar 3, 2013 at 18:01
  • Added some more information, it should be sufficient now
    – ignite
    Commented Mar 3, 2013 at 18:26

I believe that none of the earlier responders answered the question you actually asked G., so I'll take a shot at it. Interposing the sh when executing a program as you mentioned, executes the program in a non-interactive subshell. Non-interactive shells behave differently (e.g. initialisation) from the standard interactive shell you were using when you ran the program.

Honestly I don't know what practical effect this has. As you noticed sh vmwareplayer.txt is (usually) able to execute something in the same folder, where simply typing vmwareplayer.txt (usually) will not. That has to do shell environment; it isn't any quality native to the shell or subshell itself. You can of course directly execute a program in the current directory as root: sudo ./vmwareplayer.txt. In my experience this always works just as well as sudo sh vmwareplayer.txt. I was hoping someone would come along and explain why the subshell was sometimes desirable.


Just a word of comment:

sudo executes a command with root privileges. When you call sudo vmwareplayer.txt which clearly means "run command vmwareplayer.txt with root access" and fails, because there is no such program.

sudo sh command means "execute sh command with root privileges"

and sh command will execute a command under Bourne shell.

New question arises. What are shells? This is a longer question and you will find some info on wiki I suppose.

Meanwhile, remember man is your best friend.


The sh utility is a command language interpreter/a command that executes commands read from a command line string, the standard input, or a specified file. The application ensures that the commands to be executed are expressed in the language described in Shell Command Language.

For example:

The following executes a shell command from a string: sh -c "cat myfile.txt" i.e. executes the command-- cat myfile.txt

Refer to the following link for in-depth explanation: http://pubs.opengroup.org/onlinepubs/009695399/utilities/sh.html

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .