banner



How To Execute A.sh File In Terminal

Download Article

Download Article

Linux provides several easy ways to install new programs, such as through the Ubuntu Software Center and the Synaptic Package Manager. Still, some applications must still be installed from the command prompt. This wikiHow teaches you how to install an application from an INSTALL.sh file at the command line.

Steps

  1. 1

    Download the software you wish to install. The necessary files will usually be compressed into a .tar, .tgz, or .zip file.

  2. 2

    Extract the ".tar" or ".zip" (if needed). If the software you downloaded is in an archive format like ".tar", ".tgz", or ".zip" file, you will need to extract it to get to the .sh file. If the script is already in a ".sh" file format, you can skip this step. Use one of the following methods to extract the archive file:

    • Right-click the downloaded archive, and then select Extract Here (the exact text may vary by Linux version).
    • If you are using the terminal, use the command "cd ~/path" to navigate to the location of the archive file. Replace "path" with the folder path of the file (i.e. "cd ~/Downloads").
    • To extract a ".tar", or ".tar.gz" file using the terminal, use the command "tar -xvf filename.tar" and press "Enter". Replace "filename" with the actual name of the file (i.e "tar -xvf jdk-14.0.2_linux-x64_bin.tar.gz")[1]
    • To unpack a ".zip" file from the terminal, use the command "unzip filename.zip" and press "Enter". Replace "filename" with the name of the zip file (i.e. "unzip Minecraft.zip").

    Advertisement

  3. 3

    Find one which folder the ".sh" file is in. To do this, you'll need to double-click the extracted folder and search the folders contained to see which folder contains the install.sh.

  4. 4

    Open a terminal window. The terminal has an icon that resembles a black screen with a text cursor on it. Click it in the dock or Applications menu to open the terminal.

    • A quick way to do this in most window managers is to press "Ctr + Alt + T" on the keyboard.
  5. 5

    Navigate to the path of the extracted folder. Type "cd ~/" followed by the path to the ".sh" file and press "Enter". ″ Use the a foward-slash (/) to differentiate between different folders. For example, if the file is is your downloads folder, you would type something like "cd ~/Downloads/jdk-14.0.2_linux-x64_bin/bin" and press enter.

    • To make sure you're in the right folder, type "ls -a" at the command prompt and press "Enter". You should see a list of the same files and folders.
  6. 6

    Type chmod +x install.sh and press Enter . If the installer is called something other than ″install.sh,″ type the actual filename instead. This makes the installer file executable. You won't see any confirmation message from this command.

    • As long as you don't see an error, you'll know the script is now executable.
    • You can also do this outside the terminal. The process may be different depending on your Linux distribution. To do this in Ubuntu, right-click the ".sh" file and click Properties. Click the Permissions tab and check the box that says "Allow executing file as program".
  7. 7

    Type bash install.sh and press Enter . If the file name is named something other than ″install.sh″, replace the "install.sh" with the actual file name. For example, to install Netbeans, you would type "bash netbeans-8.2-linux.sh" and press "Enter".

    • Other commands you can use include "sh install.sh" or "./install.sh". If the file name is different than "install.sh", use the actual name of the ".sh" file instead. Then press "Enter". Use any of these commands and press "Enter".[2]
  8. 8

    Enter the root user password and press Enter . This starts the installation of your application.

  9. 9

    Follow the on-screen instructions to complete the installation. Depending on the app, you may have to enter additional information to complete the install.

    • To uninstall a piece of software using the terminal, type the command "dpkg --list" to display a list of installed programs on your Linux system. Locate the program you want to uninstall and type the command "sudo apt-get --purge remove [program name]" and press "Enter". Enter the root user password and press "Enter". Then follow any instructions needed to remove the program.<ref>

    Advertisement

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

    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

    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".

  • Question

    Followed all instructions worked till last the step but nothing happened.

    Jisjo

    We would need to know the error messages when you executing each command before being able to troubleshoot your issue.

  • Question

    It states after I execute sudo ./install.sh that my platform is not supported. Does anyone know why?

    MOHMMD ELFA

    MOHMMD ELFA

    Community Answer

    Are you using 32 bit or 64 bit? If you are using 32 bit, you might be trying to start a 64 bit program. Or you might not meet the minimum requirements. Also, if you see x86, then that means 32 bit.

  • Question

    How is zipping and unzipping the script different from saving it to the desktop folder?

    MOHMMD ELFA

    MOHMMD ELFA

    Community Answer

    When you save it to desktop, that tells the file(s) to put themselves there. But when you zip and unzip, you just compress (save space) and decompress (takes up more space).

  • Question

    What is too many argument error in installation?

    MOHMMD ELFA

    MOHMMD ELFA

    Community Answer

    You put more arguments than necessary. This command has enough arguments: su name . This command has too many or too little: su Jane Eric.

  • Question

    I typed bash install.sh but the output was install: no input file specified?

    Community Answer

    Make sure you specify where the file needs to go or you might need to go into a folder outside of the home directory.

  • Question

    After I have entered the printer name, MX490USB, the terminal window closes. I receive no messages. I find it strange, because I see it has already identified the printer in the previous step.

    Rohankumaryadavs

    Rohankumaryadavs

    Community Answer

    To fix this, just reset your devices. Or, you'll need to run through a wizard. Here's how: Open Windows search by pressing Windows Key + Q. Type in "printer." Select Printers & Scanners. Hit Add a printer or scanner.

Ask a Question

200 characters left

Include your email address to get a message when this question is answered.

Submit

Advertisement

About This Article

Article SummaryX

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 309,094 times.

Is this article up to date?

How To Execute A.sh File In Terminal

Source: https://www.wikihow.com/Execute-INSTALL.sh-Files-in-Linux-Using-Terminal

Posted by: buckleybity1957.blogspot.com

Related Posts

0 Response to "How To Execute A.sh File In Terminal"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel