How to Run an Script on Linux in 4 Easy Steps

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


Open a Terminal window.

On most Linux desktop environments, you can open a Terminal by pressing .

  • Before installing software, make sure to check the README or INSTALL file that came in your download for specific instructions and installation options.

Use cd to enter the folder that contains the script.

For example, if is in your Downloads folder, type cd ~/Downloads and press 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 file, as well as all other files in the directory.

Make the file executable.

The trick to getting the script to run is to change its permissions. To do this, type chmod +x and press .

  • If you’re unable to change the permissions, you’ll need root access. Instead, run sudo chmod +x and press Enter.
  • If you don’t see an error, you’ll know the install script is now executable.

Execute the script.

To do this with root access, type sudo ./ and press .

  • You can also use the command sudo bash or sudo 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 ./ instead.
  • Depending on the script and app you’re installing, you may be prompted to complete additional steps to install the software.


  • Depending on the program, you might wind up with an script that you can use to uninstall it. To uninstall, make the uninstall script executable with chmod +x, 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 executable using chmod +x, you can also run the script from your desktop environment by double-clicking the file.

Leave a Comment