How do I make a Linux or FreeBSD file an executable file?

by on March 30, 2006 · 1 comment· LAST UPDATED March 30, 2006

in

You need to use chmod command which is use to change file access permissions as well as to setup an executable permission on file.

General syntax:
chmod +x file-name

For example to setup executable permission on a file called foo.sh (shell script):

$ chmod +x foo.sh

To execute file:

$ ./foo.sh

To setup executable permission on a binary file called bar:

$ chmod +x bar

To execute binary file:

$ ./bar

See also:

TwitterFacebookGoogle+PDF versionFound an error/typo on this page? Help us!

{ 1 comment… read it below or add one }

1 Jonathan April 19, 2014 at 10:22 pm

Thanks for this. I’m trying to work from the CLI as much as poss. these days. Trouble was I had to keep going back to the GUI to make my simple scripts executable.

Reply

Leave a Comment

Tagged as:

Previous Faq:

Next Faq: