PDF download Download Article
The easiest way to run an INSTALL.sh script in a Linux terminal window
PDF download Download Article

Did you download Linux software that came with an install.sh file? Install.sh is a simple text-based shell script that makes it easy to install software. To use an install.sh script, you'll first need to make it executable using chmod +x install.sh . Then, you can execute the script in a terminal with the command ./install.sh or sudo ./install.sh . This wikiHow guide will walk you through executing an install.sh file from the Linux command line using Ubuntu, Debian, and any other version of Linux.

How to Install .sh Files

Install.sh is a simple text-based shell script that makes it easy to install software. To use an install.sh script, you'll first need to make it executable using chmod +x install.sh. Then, you can execute the script in a terminal with the command ./install.sh or sudo ./install.sh.

  1. On most Linux desktop environments, you can open a Terminal by pressing Ctrl + Alt + T .
    • Before installing software, make sure to check the README or INSTALL file that came in your download for specific instructions and installation options.
  2. For example, if install.sh is in your Downloads folder, type cd ~/Downloads and press Enter to enter that directory.
    • If the file you downloaded is compressed into a TGZ or TAR.GZ archive, be sure to unpack the files first.
    • You can extract a TGZ or TAR.GZ file using the command tar -xzvf filename.tgz .
    • To make sure you’re in the right directory , type ls -a and press Enter . You should see your install.sh file, as well as all other files in the directory.
    Advertisement
  3. The trick to getting the install.sh script to run is to change its permissions . To do this, type chmod +x install.sh and press Enter .
    • If you're unable to change the permissions, you'll need root access. Instead, run sudo chmod +x install.sh and press Enter .
    • If you don’t see an error, you’ll know the install script is now executable.
  4. To do this with root access, type sudo ./install.sh and press Enter .
    • You can also use the command sudo bash install.sh or sudo sh install.sh to run the script.
    • If you're just installing the software in your own home directory and don't need root permissions, you can use omit sudo and use ./install.sh instead.
    • Depending on the script and app you're installing, you may be prompted to complete additional steps to install the software .
  5. Advertisement

Community Q&A

Search
Add New Question
  • Question
    How to run a Linux program from terminal
    Community Answer
    Enter these commands into the terminal: cd /location of file/. For example, /home/username/Documents./name_of_file.extension. Replace these with the name of the file/program and the extension (commonly .desktop in Linux or .exe (executable) or .sh (script). Make sure the file/program is marked as executable in its properties.
  • Question
    I typed: chmod +x install.sh but the output is chmod: cannot access 'install.sh': No such file or directory.
    Pingu
    Top Answerer
    This means that there is no install.sh file. Linux is case-sensitive, so if you type the file name as install.sh, it won't find a file that is named, for example, INSTALL.sh. Also check for typos, like typing isntall.sh instead of install.sh. Try typing ls to list all files in the current directory. If the install.sh file is not in the current directory, you need to change into the directory with that file using the cd command.
  • Question
    I want my (.sh) files to be executable by 1 word like "test" without commanding "./test.sh | bash test.sh". How to do that?
    Pingu
    Top Answerer
    If that's a program that someone else wrote, you can usually run "sudo make install" to install it, and then it will be possible to just type the program name. If it is a script that you wrote yourself, do the following: Add the line "#!/bin/bash" (without the quotation marks) to the beginning of the script file. Rename the file to not have ".sh" at the end, for example "test.sh" to just "test". Finally, move your file to the "/usr/bin" directory. Then, you can just type the word (in this example, "test") to execute the script. Also, when working from the Linux bash shell, you don't need to type the " | bash test.sh" part, you can just write "./test.sh".
See more answers
Ask a Question
      Advertisement

      Tips

      • Depending on the program, you might wind up with an uninstall.sh script that you can use to uninstall it. To uninstall, make the uninstall script executable with chmod +x uninstall.sh , then run ./uninstall or sudo ./uninstall .
      • You can also change a file's permissions using your desktop environment's file manager. In Ubuntu , right-click the ".sh" file, choose Properties , and then click the Permissions tab. Check the box that says "Allow executing file as program," and then click Close .
      • Once you make install.sh executable using chmod +x , you can also run the script from your desktop environment by double-clicking the file.
      Submit a Tip
      All tip submissions are carefully reviewed before being published
      Name
      Please provide your name and last initial
      Thanks for submitting a tip for review!
      Advertisement

      About This Article

      Article Summary X

      1. Download and extract the package.
      2. Open a terminal window.
      3. Go to the folder that contains the "install.sh" file.
      4. Use " chmod +x " to make "install.sh" executable.
      5. Type " bash install.sh " and press Enter.
      6. Enter the root password and follow the on-screen instructions.

      Did this summary help you?
      Thanks to all authors for creating a page that has been read 579,327 times.

      Is this article up to date?

      Advertisement