Skip to main content

Home/ Web Development, Design & Programming/ Contents contributed and discussions participated by Herb Tucker

Contents contributed and discussions participated by Herb Tucker

Herb Tucker

Unix Stat Command: How To Identify File Attributes - 0 views

  • Question: How do I find out all the available file attributes. i.e I would like to know more about a file or directory than what the ls -l command displays
  • Answer: Everything in Unix is treated as files. This includes devices, directories and sockets — all of these are files. Stat command displays file or filesystem status as explained in this article.
  • You can use the same command to display the information about a directory as shown below.
  • ...1 more annotation...
  • You can also use stat command to display the file system information as shown below
Herb Tucker

Linux Knowledge Base and Tutorial - 0 views

  • The UMASK value masks out the bits. The permissions that each position in the UMASK masks out are the same as the file permissions themselves. So, the left-most position masks out the owner permission, the middle position the group, and the right most masks out all others. If we have UMASK=007, the permissions for owner and group are not touched. However, for others, we have the value 7, which is obtained by setting all bits. Because this is a mask, all bits are unset. (The way I remember this is that the bits are inverted. Where it is set in the UMASK, it will be unset in the permissions, and vice versa.)
  • The problem many people have is that the umask command does not force permissions, but rather limits them
  • Therefore, setting the UMASK=007 does not force creation of executable programs, unless the program creating the file does itself).
  • ...6 more annotations...
  • - - regular file c - character device b - block device d - directory p - named pipe l - symbolic link
  • Lets look at a more complicated example. Assume we have UMASK=047. If our program creates a file with permissions 777, then our UMASK does nothing to the first digit, but masks out the 4 from the second digit, giving us 3. Then, because the last digit of the UMASK is 7, this masks out everything, so the permissions here are 0. As a result, the permissions for the file are 730. However, if the program creates the file with permissions 666, the resulting permissions are 620. The easy way to figure out the effects of the UMASK are to subtract the UMASK from the default permissions that the program sets. (Note that all negative values become 0.)
  • You can change it anytime using the umask command. The syntax is simply umask <new_umask>
  • Here the <new_umask> can either be the numeric value (e.g., 007) or symbolic. For example, to set the umask to 047 using the symbolic notation, we have umask u=,g=r,o=rwx
  • Where "new_owner" is the name of the user account we want to sent the owner of the file to, and "filename" is the file we want to change. In addition, you can use chown to change not only the owner, but the group of the file as well. This has the general syntax: chown new_owner.new:group filename
  • Another useful trick is the ability to set the owner and group to the same ones as another file. This is done with the --reference= option, which sets to the name of the file you are referencing. If you want to change just the group, you can use the chgrp command, which has the same basic syntax as chown. Not that both chgrp and chmod can also take the --reference= option. Further, all three of these commands take the -R option, which recursively changes the permissions, owner or group.
Herb Tucker

Chmod and setting permissions Linux, Unix, and *nix like Operating Systems forum at Web... - 0 views

  •  
    good tuturial
Herb Tucker

PHP: Expressions - Manual - 0 views

  • (scalar values are values that you can't 'break' into smaller pieces, unlike arrays, for instance
  • Expressions are the most important building stones of PHP. In PHP, almost anything you write is an expression
  • The simplest yet most accurate way to define an expression is "anything that has a value"
  • ...16 more annotations...
  • PHP also supports two composite (non-scalar) types: arrays and objects. Each of these value types can be assigned into variables or returned from functions.
  • PHP is an expression-oriented language
  • Since assignments are parsed in a right to left order, you can also write '$b = $a = 5'
  • and that's the value of the assignment itself
  • A very common type of expressions are comparison expressions. These expressions evaluate to either FALSE or TRUE. PHP supports > (bigger than), >= (bigger than or equal to), == (equal), != (not equal), < (smaller than) and <= (smaller than or equal to). The language also supports a set of strict equivalence operators: === (equal to and same type) and !== (not equal to or not same type). These expressions are most commonly used inside conditional execution, such as if statements.
  • and is assigned back into $a,
  • The last example of expressions we'll deal with here is combined operator-assignment expressions
  • Adding 3 to the current value of $a can be written '$a += 3'
  • This means exactly "take the value of $a, add 3 to it, and assign it back into $a"
  • Any two-place operator can be used in this operator-assignment mode, for example '$a -= 5' (subtract 5 from the value of $a), '$b *= 7' (multiply the value of $b by 7), etc.
  • There is one more expression that may seem odd if you haven't seen it in other languages, the ternary conditional operator:
  • If the value of the first subexpression is TRUE (non-zero), then the second subexpression is evaluated, and that is the result of the conditional expression. Otherwise, the third subexpression is evaluated, and that is the value
  • Some expressions can be considered as statements. In this case, a statement has the form of 'expr ;' that is, an expression followed by a semicolon. In '$b = $a = 5;', '$a = 5' is a valid expression, but it's not a statement by itself. '$b = $a = 5;' however is a valid statement.
  • One last thing worth mentioning is the truth value of expressions. In many events, mainly in conditional execution and loops, you're not interested in the specific value of the expression, but only care about whether it means TRUE or FALSE. The constants TRUE and FALSE (case-insensitive) are the two possible boolean values.
  • Throughout the rest of this manual we'll write expr to indicate any valid PHP expression.
  • Functions are expressions with the value of their return value.
  •  
    Expressions defined and discussed with highlighting
1 - 20 of 35 Next ›
Showing 20 items per page