Search code examples
linuxunixmkdir

mkdir options are not clear


I just ran into this line:

mkdir /cache 0770 system cache

but didn't find on web what's the "system cache" mean. 0770 is the permission I guess, but this line doesn't look like something that suits what's described here:

http://linux.die.net/man/1/mkdir

edit: sorry, these lines are in init.rc , I guess it's different then what I expected.. for example, in creating simbolic link here is "symlink" and not "ls -s". what language is this ?


Solution

  • As you say in your edit, this is a line in a rc.init file which contains information for the init process on a *nix system. The "words"/fields have specified meanings. The first one is a "command" to the init process, but does not necessarily correspond to an existing binary or shell script in the path. Instead, it is a key word which specifies what the init process is to do. As the name suggests, the "mkdir" keyword instructs it to make a directory; but it could as well be named "makedirectory" or whatever. The specific syntax for it is

    mkdir <path> [mode] [owner] [group]
    

    In your example

    mkdir /cache 0770 system cache
    
    • the directory path is /cache (in the root directory)
    • the mode is 0770 (give user and group all rights to read, write and execute; give anybody else no rights)
    • make user "system" the owner
    • make group "cache" the group.

    For a list of possible init commands in android, cf. this list.