This guide will show you how to run files in Linux. You can execute most files through a graphical file manager, which is typically pre-installed on most Linux distributions. Alternatively, the Terminal provides a powerful command-line interface, especially useful for running script files like .sh, .run, and .bin.
How to run a file in Linux
Follow these detailed steps to execute files on your Linux system, using either a graphical file manager or the command line.
Using a file manager
- Open a file manager application. Most Linux distributions include a default file manager such as Nautilus, Thunar, Dolphin, Krusader, Konqueror, or PCManFM. You can typically find its icon resembling a file cabinet or a folder labeled “Home” on your desktop, dock, or Activities menu.
- If you can’t find it: Press the Super (Windows) key and type “Files” into the search bar.
- To install a different file manager: Open the Terminal.
- If Debian/Ubuntu: Type
sudo apt install <app name>and press Enter. - If Fedora: Type
sudo dnf install <app name>and press Enter. (Replace<app name>with the desired application name.)
- If Debian/Ubuntu: Type
- Navigate to the folder where your file is located by double-clicking folders in the large browsing panel.
- Right-click the file you want to run to display a drop-down menu. You can also double-click the file to run it with its default associated application.
- Click Open With or Open With Other Application from the menu.
- Double-click the application you want to use to run the file. If your desired application is not immediately visible, click View All Applications or Other to see a categorized list of all installed apps.
Using the Terminal
- Press Ctrl+Alt+T to open the Terminal. Alternatively, click the Terminal icon (often a black screen with a white text cursor) in your Apps menu.
- Change the directory to the folder containing the file. Type
cdfollowed by the directory path (e.g.,cd /Documents) and press Enter. - Type
sudo chmod +x <filename>and press Enter. (Replace<filename>with the exact name of your file, ensuring no spaces). This command grants execute permissions to the file. If prompted, enter your Linux computer’s password and press Enter. - Type the appropriate command to run the file based on its type and press Enter:
- To run executable scripts (.sh, .run, .bin): Type
sudo ./<filename> - To open a file with its default application: Type
xdg-open <filename> - To display an image file (requires ImageMagick): Type
display <filename> - To display a text file directly in the Terminal: Type
cat <filename> - To display a text file one page at a time: Type
less <filename> - To display a text file with numbered lines: Type
nl <filename>
- To run executable scripts (.sh, .run, .bin): Type
What to do next?
Mastering file execution is a fundamental skill in Linux. Once you’re comfortable with these methods, consider exploring other powerful aspects of the Linux command line. Learning more commands can significantly enhance your productivity and control over your system.
You might also want to delve into shell scripting, which allows you to automate repetitive tasks and create custom commands. Many online resources and communities are available to help you continue your journey in Linux, providing a pathway to becoming a more proficient user.




