If you have downloaded software from the internet and found a file ending with .run, you might be wondering how to run a run file in Linux. Run files in Linux are usually self-extracting archives that need executable permissions before they can be launched.
These files are common for installing drivers, games, or proprietary software. The process is straightforward, but you need to use the terminal and set the correct permissions. Let me show you exactly how to do it step by step.
How To Run A Run File In Linux
To run a .run file, you first need to make it executable. This is done with the chmod command. After that, you execute it with a simple command. Here is the complete process.
Step 1: Open The Terminal
Press Ctrl + Alt + T on your keyboard. This opens the terminal window. You can also search for “Terminal” in your applications menu.
Step 2: Navigate To The File Location
Use the cd command to go to the directory where your .run file is saved. For example:
cd ~/Downloads
If your file is on the desktop, use:
cd ~/Desktop
Step 3: Make The File Executable
Run this command to add execute permissions:
chmod +x filename.run
Replace filename.run with the actual name of your file. For instance, if the file is called installer.run, you would type:
chmod +x installer.run
Step 4: Execute The Run File
Now run the file with this command:
./filename.run
The ./ tells Linux to look in the current directory. If you get a permission error, double-check that you used chmod +x correctly.
Understanding Run Files In Linux
A .run file is not a standard Linux package format like .deb or .rpm. It is a shell script that contains compressed data. When you run it, the script extracts the data and starts the installation process.
These files are often used by companies like NVIDIA for their graphics drivers. They can also be used for game installers or custom software.
What Happens When You Execute A Run File?
- The script checks your system for dependencies
- It extracts the embedded archive (usually tar or gzip)
- It runs the actual installer or program
- It may ask for your root password if it needs system-wide installation
Common Errors And Fixes
Sometimes things go wrong. Here are the most common issues you might face when trying to run a .run file.
Error: Permission Denied
This means the file is not executable. Run chmod +x filename.run again. Make sure you are in the correct directory.
Error: Command Not Found
If you see this, you probably typed the command wrong. Check for typos. Also, ensure you included the ./ before the filename.
Error: No Such File Or Directory
You are not in the right folder. Use ls to list files and verify the .run file is there. Then navigate to the correct directory.
Error: Missing Dependencies
Some .run files require libraries like libc6 or libstdc++. Install them using your package manager. For Ubuntu or Debian:
sudo apt update
sudo apt install libc6 libstdc++6
Running Run Files With Sudo
Many .run files need root privileges to install system-wide. You can run them with sudo:
sudo ./filename.run
Be careful with this. Only run files from trusted sources when using sudo. A malicious .run file could harm your system.
When To Use Sudo
- Installing drivers (like NVIDIA or AMD)
- Installing software to system directories like
/usr/local - Running scripts that modify system files
Graphical Method: Running Run Files Without Terminal
If you prefer not to use the terminal, you can still run .run files. Most file managers allow you to make files executable from the right-click menu.
Using Nautilus (GNOME Files)
- Right-click the .run file
- Select “Properties”
- Go to the “Permissions” tab
- Check “Allow executing file as program”
- Close the window
- Double-click the file and choose “Run” or “Run in Terminal”
Using Dolphin (KDE)
- Right-click the .run file
- Select “Properties”
- Go to the “Permissions” tab
- Check “Is executable”
- Close and double-click the file
Checking File Integrity Before Running
It is a good idea to verify the .run file before executing it. Many developers provide checksums like SHA256 or MD5. Here is how to check:
sha256sum filename.run
Compare the output with the checksum provided on the official website. If they match, the file is safe and not corrupted.
Why Checksums Matter
- They confirm the file was downloaded correctly
- They verify the file has not been tampered with
- They protect you from malicious modifications
Extracting A Run File Without Running It
Sometimes you might want to extract the contents of a .run file without actually installing it. This is useful if you want to inspect the files or modify them.
Use the --noexec flag to extract without executing:
./filename.run --noexec --target /path/to/extract
This will extract the archive to the specified directory. You can then look at the files manually.
Manual Extraction Using Tail And Tar
Some .run files are just shell scripts with a tar archive appended. You can extract them manually:
tail -c +$(grep -a -b -o 'BZh' filename.run | head -1 | cut -d: -f1) filename.run | tar -xzvf -
This command finds the start of the compressed data and extracts it. It works for bzip2 compressed archives.
Creating Your Own Run File
You can also create .run files for your own projects. This is handy for distributing scripts or software. Here is a basic example.
Simple Run File Script
#!/bin/bash
echo "This is a custom run file"
# Your installation commands here
exit 0
Save this as myscript.run. Then make it executable:
chmod +x myscript.run
You can now distribute this file. Users can run it with ./myscript.run.
Adding Compressed Data To A Run File
To create a self-extracting archive, you need to combine a script with compressed data. Here is a simple method:
- Create your installer script
- Compress your files with
tar -czf data.tar.gz files/ - Append the archive to the script:
cat script.sh data.tar.gz > installer.run - Make it executable
In the script, you can extract the data using tail and tar.
Run Files Vs Other Linux Package Formats
Linux has several package formats. Here is how .run files compare to others.
| Format | Description | Package Manager |
|---|---|---|
| .run | Self-extracting script | None (manual) |
| .deb | Debian package | apt, dpkg |
| .rpm | Red Hat package | yum, dnf, rpm |
| .AppImage | Portable application | None (run directly) |
| .flatpak | Sandboxed application | flatpak |
Run files are less common today because package managers are more convenient. But they are still used for proprietary software and drivers.
Security Considerations
Running a .run file gives it full access to your user account. If you use sudo, it gets system-wide access. Always follow these safety tips.
Safety Checklist
- Only download .run files from official websites
- Verify checksums when available
- Read the script first with
cat filename.run | less - Run in a virtual machine if you are unsure
- Keep backups of important data
How To Inspect A Run File
You can view the script part of a .run file without executing it:
head -50 filename.run
This shows the first 50 lines. Most .run files start with a shell script. Look for suspicious commands like rm -rf / or wget to unknown URLs.
Troubleshooting Specific Scenarios
Different .run files may behave differently. Here are some specific cases.
NVIDIA Driver Run File
NVIDIA provides a .run file for their Linux drivers. To install it:
- Stop the X server (log out and press Ctrl+Alt+F2)
- Run
sudo ./NVIDIA-Linux-*.run - Follow the prompts
- Reboot
Game Installers
Some games use .run files. For example, the Unreal Tournament installer. Run it normally with ./game-installer.run. It may ask for installation directory.
Software Development Kits
SDKs like the Android NDK sometimes come as .run files. Extract them with ./android-ndk.run and follow the instructions.
Automating Run File Execution
If you need to run .run files often, you can automate the process. Create a simple script that does the steps for you.
Example Automation Script
#!/bin/bash
# Run a .run file automatically
FILE="$1"
if [ -z "$FILE" ]; then
echo "Usage: $0 filename.run"
exit 1
fi
chmod +x "$FILE"
./"$FILE"
Save this as run-run.sh and make it executable. Then use it like:
./run-run.sh installer.run
Run Files On Different Linux Distributions
The process is mostly the same across distributions. But there are slight differences in package management and dependencies.
Ubuntu And Debian
These use apt. Install missing libraries with sudo apt install. The terminal commands work exactly as described.
Fedora And Red Hat
Use sudo dnf install for dependencies. The chmod and ./ commands are the same.
Arch Linux
Use sudo pacman -S for dependencies. Arch users often prefer AUR packages over .run files.
OpenSUSE
Use sudo zypper install. The rest is identical.
Frequently Asked Questions
What is a .run file in Linux?
A .run file is a self-extracting archive that contains a shell script and compressed data. It is used to distribute software that does not follow standard package formats.
Can I run a .run file without terminal?
Yes. You can right-click the file, go to Properties, and check “Allow executing file as program”. Then double-click to run it.
Is it safe to run .run files?
Only if you trust the source. Always verify checksums and inspect the script if possible. Running untrusted .run files with sudo is dangerous.
Why do I get “command not found” when running a .run file?
You probably forgot the ./ prefix. Type ./filename.run instead of just filename.run.
How do I extract a .run file without installing?
Use the --noexec flag: ./filename.run --noexec --target /tmp/extract. This extracts the contents without running the installer.
Final Tips For Running Run Files
Always read the documentation that comes with the .run file. Some installers have specific requirements or options. Use the --help flag to see available options:
./filename.run --help
If you are unsure about a file, run it in a test environment first. Virtual machines are great for this. You can also use containers like Docker to test installations.
Remember that .run files are not the standard way to install software on Linux. Most applications are available through your package manager. Only use .run files when there is no other option.
With these steps, you should be able to handle any .run file you encounter. The process is simple once you understand the basics of permissions and execution. Practice with a harmless script first to build confidence.
Now you know exactly how to run a run file in Linux. Go ahead and try it with a safe file. You will see it is not as complicated as it seems.