Why a script file .sh on ubuntu is not in green as the others?
Solution 1:
It is because that file has no execute permission. The ls
program shows the names of executable files in green. Try listing with ls -l
- the permissions will be listed to the left of the filenames. r
means read, w
means write, and x
means execute. There are three sets of permissions - a set for the owner of the file, a set for the group associated with the file (ls -l
also lists these), and a set for "others" which is any user or program. To make the file executable for the owner, you can run chmod u+x
, for example.