You are viewing a single comment's thread from:

RE: Let's Learn Bash! Tutorial 001

in #technology7 years ago (edited)

chmod -x [file]

That actually removes executable permissions from the file. You wanted "+x" instead of "-x".

We don't say "back one directory" because the computer's file system has a tree like structure.

That would have been a good time to point out that it's actually up a directory because it's a tree. Similarly it's down a directory when going into the Downloads... but I suppose this isn't terribly important.

Nice article.

After some consideration, I'd like to add a few more comments.

If the computer says we do not have permission than add sudo to the front of the command.

While this will technically work, you should probably consider whether the proper user owns the file. If the file is yours, you can change the mode to anything you want. If you use sudo you're becoming the root user before executing the command, and you should be aware that 755 means that the owner of the file will have read, write, and execute. Other users in the same group will have read and execute permissions. Everyone else on the system will have read and execute permissions. Generally this is acceptable, but if you are blindly running sudo before your chmod you should be aware of these consequences because it's an unusual situation where your user does not own the file.

I'd also like to add that even though it is a little intimidating for new users, the man page for Bash is incredibly thorough. You can check it out with man bash on your system, or online.

Sort:  

I'll update the chmod line now thanks for catching that.

Also thanks for the additions. I am trying to keep these at one thousand words so I appreciate the extra info in your comment. I had to pick and choose what to add in this post and where to expand deeply. Naturally things will get left out.

Yeah, I was aware of why you may have left things out, which is why I originally wasn't going to add more, but since you are aiming at beginners, I worry that they might not consider the consequence of just adding sudo to all of their commands.

But then it occurred to me, hey, this place is great for discussion, so I'd add it anyway as a sort of discussion point.

Also, the markdown on your edit is a bit off.

hahaha yeah I noticed that about the markdown when I was reading it over. But yes pleas feel free to bring up something that might not be clear as I go through this. We both know how deep this can be.