Thursday, February 7, 2013

On a unix-like system, how can I set the file permissions of a file to the current default permissions?

Q. Let us suppose I have a file set to the permissions -rwxr----- but the default on the system is -rwx-r-xr-x and insead of using the typical chmod command typing chmod 755 fileName, could I just type a command that sets it to the current default? I am using Ubuntu 12.04 but it would be much appreciated if it worked on mac and other linux versions as well.

A. There is no system default. However, there may will be a default set when you login. It is possible to derive the chmod value from the umask, but be aware that the umask is inverted:

$ umask
0022
$ touch ttt ; ls -l ttt
-rw-r--r-- 1 chris chris 0 Sep 14 23:37 ttt

Here's a tip. If you want to set permissions to rwx-r-xr-x, then don't bother trying to convert that to octal, just use the symbolic setting: chmod u=rwx,g=rx,o=rx fileName. Similar bits on the LHS can be merged, thus giving u=rwx,go=rx.

Don't use the x (execute) bit for files unless they really are supposed to be executable. u=rw,go=r is quite sufficient.

why is the UK version of yahoo home page defaulting to mobile in Linux versions of chrome?
Q. I'm using Ubuntu both i386 and 64bit and the latest version of chrome downloaded from Google its happening on several machines I'm using. Is there some kind of global account setting that would do this?

A. Does it happen when you are logged out or only when logged in?

Have you tried clearing your cache?

If it happens only when you login, it is an account setting.

If it goes away after clearing your cache, you may have visited a link to the mobile site and a cookie got set for it.

If it is happening when you are logged out and you have cleared your cache, it is probably related to your user agent.

You could use the following command to change your user agent to that of an IE9 browser:

google-chrome --user-agent="Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)"

If this fixes it, which it should, you would want to check your current user-agent and see if there is anything weird about it. Changing your user agent should only be a temporary solution, it can cause problems long term.

How to make a terminal executable file?
Q. If I wanted to run a command on either Mac or Linux by the click of a button (opening a file), what would I do? I'm looking for a Mac/Linux version of a .bat file.

A. Linux has shell scripts which are typically written in SH files. Since Macintosh and Linux are both based on Unix, I suppose Macintosh probably has exactly the same thing.



Nec Projector Review

Plastic Shed Reviews

Ati Graphic Reviews

Nurse Uniforms Reviews

Cabochons Reviews

Inflatable Water Slides Reviews

Barcode Scanner Reviews

No comments:

Post a Comment