How do I mark a file as executable on Xubuntu?

30,767
  1. Press Ctrl+Alt+T to open a terminal.
  2. Navigate to the location of your file by inputting cd command into the terminal Eg. cd /documents/, then enter the following:

    chmod +x yourfilename
    

To view if your changes had been saved enter the following ls -l in the terminal.

Other way to change your file to an executable is to right click the file, select PropertiesPermisions and tick Allow execution of the file as a program.

Hope this helps. Also to execute the file you first have to be in the directory where it is located. For instance if your file is located in the Documents folder, you have to cd ("change directory") in to that directory and then do this: ./yourfile.c

This is how it will look:

root@root:~/Documents$ ./file.c
Share:
30,767
Ben
Author by

Ben

Just a Xubuntu user that knows a small amount about terminals and is trying to learn.

Updated on September 18, 2022

Comments

  • Ben
    Ben over 1 year

    I need to know how to mark a file as executable but the check box is not there.

  • laurent
    laurent over 10 years
    You don't need to CD to the directory of the file to execute it if the directory is on the PATH or if you include the full path when executing like ~/bin/file-to-execute
  • Evgeny Danilenko
    Evgeny Danilenko over 10 years
    yes I know. But he barely knows how to make the file an executable (no offence). I only answered what he needed to know.
  • Ben
    Ben over 10 years
    I am logged in as the correct user. Also the file I am trying to do this on is a .jar. I am a complete noob at Xubuntu so if I cant quite understand some of the things you say I'm sorry.
  • laurent
    laurent over 10 years
    So this is why it can't be marked as executable as jar files are not executables directly. Have a look at this answer askubuntu.com/questions/321780/…