Yahoo web hosting - < Direct the contents of a file
< Direct the contents of a file to the command. > Direct the output of a command to a file, deleting the existing file. >> Direct the output of a command to a command, adding the output to the end of the existing file. Here are some examples of command lines where information is directed to and from files: $ mail root < ~/.bashrc $ nroff -man /usr/share/man/man1/chmod.1* > /tmp/chmod $ echo “I finished the project on $(date)” > ~/projects In the first example, the contents of the .bashrc file in the home directory are sent in a mail message to the computer s root user. The second command line formats the chmod man page (using the nroff command) and sends the output to the file /tmp/chmod (erasing the previous /tmp/chmod file, if it existed). The final command results in the following text being added to the user s project file: I finished the project on Sun Nov 25 13:46:49 PST 2001 Understanding file permissions After you ve worked with Linux for a while, you are almost sure to get a Permission Denied message. Permissions associated with files and directories in Linux were designed to keep users from accessing other users private files and to protect important system files. The nine bits assigned to each file for permissions define the access that you and others have to your file. Permission bits appear as rwxrwxrwx. The first three bits apply to the owner s permission, the next three apply to the owner s group, and the last three apply to all others. The r stands for read, the w stands for write, and the x stands for execute permissions. If a dash appears instead of the letter, it means that permission is turned off for that associated read, write, or execute. You can see the permission for any file or directory by typing the ls -ld command. The named file or directory appears as those shown in the example below: $ ls -ld ch3 test -rw-rw-r– 1 chris sales 4983 Jan 18 22:13 ch3 drwxr-xr-x 2 chris sales 1024 Jan 24 13:47 test The first line shows a file (ch3) that has read and write on for the owner and the group. All other users have read permission, which means they can view the file but cannot change its contents or remove it. The second line shows a directory (indicated by the letter d before the permission bits). The owner has read, write, and execute permission, while the group and other users have only read and execute permissions. As a result, only the owner can add, change, or delete files in that directory. Any other user, however, can only read the contents, change to that directory, and list the contents of the directory. If you own a file, you can change the permission on it as you please. You can do this with the chmod command. For each of the three sets of permission on a file (read, write, and execute), the r is assigned to the number 4, w to 2, and x to 1. So to make permissions wide open for yourself as owner, you would set the first number to 7 (4 plus 2 plus 1). The same would be true for group and other permission. Any combination of permissions can result from 0 (no permission) through 7 (full permission). Here are some examples of how to change permission on a file and what the resulting permission would be: chmod 777 files rwxrwxrwx
We highly recommend you visit web and email hosting services if you need stable and cheap web hosting platform for your web applications.