Monthly Archives: May 2013

chomod, permission change in linux

This is from “http://www.computerhope.com/unix/uchmod.htm

chmod [OPTION]… MODE[,MODE]… FILE…
chmod [OPTION]… OCTAL-MODE FILE…
chmod [OPTION]… –reference=RFILE FILE…

-c, –changes like verbose but report only when a change is made
–no-preserve-root do not treat `/’ specially (the default)
–preserve-root fail to operate recursively on `/’
-f, –silent, –quiet suppress most error messages
-v, verbose output a diagnostic for every file processed
–reference=RFILE use RFILE’s mode instead of MODE values
-R, –recursive change files and directories recursively
–help display this help and exit
–version output version information and exit

Permissions
u – User who owns the file.
g – Group that owns the file.
o – Other.
a – All.
r – Read the file.
w – Write or edit the file.
x – Execute or run the file as a program.

Numeric Permissions:
CHMOD can also to attributed by using Numeric Permissions:

400 read by owner
040 read by group
004 read by anybody (other)
200 write by owner
020 write by group
002 write by anybody
100 execute by owner
010 execute by group
001 execute by anybody

Examples

The above numeric permissions can be added to set a certain permission, for example, a common HTML file on a Unix or Linux server accessible over the Internet would be given the below permissions.

chmod 644 file.htm

This gives the file read/write by the owner and only read by everyone else (-rw-r–r–).

Files such as scripts that need to be executed need more permissions. Below is another example of a common permission given to scripts.

chmod 755 file.cgi

This would be the following 400+040+004+200+100+010+001 = 755 where you are giving all the rights except the capability for anyone to write to the file.cgi file(-rwxr-xr-x).

chmod 666 file.txt

Finally, another common CHMOD permission is 666, as shown below, which is read and write by everyone.

Tip: The above commands are all done through the command line. However, if you upload a file using FTP these permissions can also be adjusted through many FTP clients by right-clicking the file and choosing permissions.

Additional information

Below is an example of how a file may be listed when typing ( ls -l ) at the prompt as well as information on how to interpret it.

-rw-rw-r– 1   hope 123   Feb 03 15:36   file.txt

rw rw- r– 1 hope 123 Feb 03 15:36 file.txt
File owner group everyone else links owner size mod date file name

Numerical Jacobian matrix calculation method with matlab code

In this post, I share a numerical Jacobian matrix calculation method with matlab code.

Actually there is a function in Matlab inherently, but it is very complex. ( look at the function, NumJac ), So I made a very simple version. I wish this can help you.

You can download from here.

The attachment file includes 

1. NumJacob.m : main file it generates jacobian matrix. 

2. Demo.m : demo file

3. test_func.m : test function to show its demo

 

The below is a simple example.

>> NumJacob(@cos,1)

ans =

-0.8415

 

>> x0=[0;1]; other_param=[1;2];
>> df=NumJacob(@test_func,x0,other_param)

df =

1.0000 0
0 2.0000

 

 

Because the code is very easy, probably you can easily understand the codes.

Then, good luck ^^

if you have any question, please leave me a comment below.

 

Added on Feb 07. 2014

I am uploading another demo file to give a solution of Mahmudul’s request (for detail, see the comment).

This demo file is to get a numerical Jacobian for the below function

y1′ = y2*y3; y1(0) = 0
y2′ = -y1*y3; y2(0) = 1
y3′ = -0.51*y1*y3; y3(0) =1

Download this demo file. 

 

Added on Mar/21 2015

If you are interested in calculating numerical Jocobian matrix for a complex number, please read this post.

http://youngmok.com/matlab-code-for-numerical-calculation-of-jacobian-matrix-for-a-complex-number/

 

—————————————————————————————————

I am Youngmok Yun, and writing about robotics theories and my research.

My main site is http://youngmok.com, and Korean ver. is  http://yunyoungmok.tistory.com.

—————————————————————————————————