1

I am currently following one python3 course at the time. For easy execution, they suggest running the following code:

chmod +x pythonFileName.py

Doing so, made it possible to run the file using: ./pythonFileName.py and this is of course much easier then navigation the entire folder structure to find my scripts.

I am wondering, are these files copied to any hidden folder? How does this command even work? I mean how does he know the right path? If I delete the script do I need to run another code? Delete the copied file from a hidden folder?

0
2

chmod +x /path/to/file sets the execute permission on the file itself. It doesn't maintain a separate list of permissions for standard read/write/execute, just sets that to the file.

Are these files copied to any hidden folder?

No, the file remains where it is. The permission is set to the file in place.

How does this command even work?

POSIX file permissions include read/write/execute permissions. Running +x adds the execute permission to all, -x removes it.

How does he know the right path?

You provide the path to the command when you run it. /path/to/file is the path you provided when you run the command.

If I delete the script do I need to run another code?

You can delete the file as usual, with rm or using Finder, without needing to run anything else. If you create a new file (regardless of the name) you will need to chmod +x /path/to/file to give it the execute permission again.

Delete the copied file from a hidden folder?

There's no copying taking place when you run chmod so there's nothing else to delete.

0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .