command line - Why do we use "./" (dot slash) to execute a file in Linux/UNIX? - Unix & Linux Stack Exchange
How can i run a downloaded file?
How to use .run file?
how to run a .bat file on linux?
Videos
I'm pretty new to Linux and I've been using the Manjaro distro, and I wanna know if there's any way of running a linux executable through the terminal.
The literal answer is as others have given: because the current directory isn't in your $PATH.
But why? In short, it's for security. If you're looking in someone else's home directory (or /tmp), and type just gcc or ls, you want to know you're running the real one, not a malicious version your prankster friend has written which erases all your files. Another example would be test or [, which might override those commands in shell scripts, if your shell doesn't have those as built-ins.
Having . as the last entry in your path is a bit safer, but there are other attacks which make use of that. An easy one is to exploit common typos, like sl or ls-l. Or, find a common command that happens to be not installed on this system — vim, for example, since sysadmins are of above-average likelyhood to type that.
Does this sound too theoretical? It largely is, but it definitely can happen in reality, especially on multi-user systems. In fact, here is an example from this site where an administrator switched to a users' home directory and found ps to be masked by an executable of that name.
In Linux, UNIX and related operating systems, . denotes the current directory. Since you want to run a file in your current directory and that directory is not in your $PATH, you need the ./ bit to tell the shell where the executable is. So, ./foo means run the executable called foo that is in this directory.
You can use type or which to get the full path of any commands found in your $PATH.
When i download a zip file from a website then unzip it how can run it in the terminal?
EDIT: It's an emulator that i've downloaded, i unzipped it but don't know if im supposed to execute it nor which file to execute
You can mark the file as executable:
chmod +x filename.sh
You can then execute it like this:
./filename.sh
If you want to use a different command to start it, you can add an alias:
gedit ~/.bashrc
Add this at the end of the file:
alias <new name>='/home/<full path to script>/filename.sh'
Open a new terminal session or type source ~/.bashrc in your terminal to apply.
Then simply use the new name to start the script.
There are two ways of making a file executable:
GUI Method:
Right-click the file and select Properties.
Go to the permissions tab, then tick the box Execute: [ ] Allow executing file as program or in Nautilus Program: [ ] Allow this file to run as a program in Thunar.

Terminal / Command method:
You can either use:
cd /to/my/required/directory
Then run
chmod +x filename.extension
Or just run:
chmod +x /path/to/your/filename.extension
chmod does also have some more advanced options:
The spaces are to show that it is split up: - rwx --- ---
The first set of --- is User. The second is Group and the last is Other (anyone else)
r stands for Read, w for Write and x for eXecute.
So to allow everyone to read it, but only Group to execute and User to read and write it (but for some reason not execute) would be:
-rw- rx- r-- But this would be added to the command as:
chmod +rw-rx-r-- /path/to/file.extension
chmod also can do this in numbers. It is based on binary (I think, as it is 1,2 and 4)
So there are these numbers:
Execute by user is 100.
Execute by group is 010.
Execute by other is 001.
Write by user is 200.
Write by group is 020.
Write by other is 002.
Read by user is 400.
Read by group is 040.
Read by other is 004.
Then you add these together to get the desired combination.
So to allow everyone to read it, but only Group to execute and User to write it (but for some reason not execute) would be:
400 + 040 + 004 and 010 and 200
That adds up to 600 + 050 + 004 = 654.
You could then run the command.
chmod +654 /path/to/file.extension to set it.
And to set all permissions you can type:
chmod +rwxrwxrwx /path/to/file.extension
Or (this is a bit easier to write, but harder to remember each one):
chmod +777 /path/to/file.extension
Finally, you can do:
chmod -777 /path/to/file.extension
To take all permissions away from everyone.
And:
chmod +300 /path/to/file.extension
To add read and write for user, without affecting any other permissions (e.g. Execute permissions).
This website has a very useful little grid checkbox thing, whereby you can tick the options you want and it gives you the command:

However, not all the possible combinations are sensible to use; the main ones that are used are the following:
755 - Owner has all, and Group and Other can read and execute
700 - Owner has all
644 - Owner can read and write, and Group and Other can read
600 - Owner can read and write
And, if you're using non-trivial user groups:
775 - Owner can read and write, and Group and Other can read
770 - Owner and Group have all, and Other can read and execute
750 - Owner has all, and Group can read and execute
664 - Owner and Group can read and write, and Other can just read
660 - Owner and Group can read and write
640 - Owner can read and write, and Group can read
777 and 666 are rarely used, except in /tmp.
Thanks Ilmari Karonen for pointing out the ones in common usage!
try:
abc/info.exe
but if it's really a Windows program, you will need to install "wine", then do:
wine abc/info.exe
but only some Windows programs will work under wine.
This anwswer is combining other answers in to this question into one.
The info.exe file will either execute under Linux or Windows, but not both.
Executes Under Windows
If the file is a windows file, it will not run under Linux on it's own. So if that's the case, you could try running it under a windows emulator (WINE). If it's not compatible with wine, then you won't be able to execute it under Linux.
Before you can start, you will need to install wine. The steps you need to install wine will vary on the linux platform you are on. You can probably google "Ubuntu install wine", if for example, you're installing ubuntu.
Once you have wine installed, then you'd be able to execute these commands.
cd abc/
wine info.exe
Execute Under Linux
if you know this file to run under linux, then you'll want to execute these commands:
Change to your abc directory
cd abc/
Then you'll want to change permissions to allow all users to execute this file (a+x).
you could also allow just the user to execute (u+x)
chmod a+x info.exe
Launch the program, the ./ tells the command line to look in the current path for the file to execute (if the 'current' directory isn't in the $PATH environment variable.
./info.exe
Give execute permission to your script:
chmod +x /path/to/yourscript.sh
And to run your script:
/path/to/yourscript.sh
Since . refers to the current directory: if yourscript.sh is in the current directory, you can simplify this to:
./yourscript.sh
You need to mark shell scripts as executable to run them from the file manager:
Right click on your
.shfile and select Properties:
In the Permissions tab, check Allow executing file as program:

Close the Properties window and double-click the file. A dialog will pop up giving you the option to run the script in a terminal:
