1 / 10

CS 497C – Introduction to UNIX Lecture 14: - File Attributes

CS 497C – Introduction to UNIX Lecture 14: - File Attributes. Chin-Chih Chang chang@cs.twsu.edu. ls: Listing Files. When you use the ls command, you will see a list of filenames arranged in ASCII collating sequence .

conor
Download Presentation

CS 497C – Introduction to UNIX Lecture 14: - File Attributes

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. CS 497C – Introduction to UNIXLecture 14: - File Attributes Chin-Chih Changchang@cs.twsu.edu

  2. ls: Listing Files • When you use the ls command, you will see a list of filenames arranged in ASCII collating sequence. • You can use ls with the filename to know whether a particular file is available. • Use the –x option to produce a multicolumn output. • Use the –F option to identify directories and executables.

  3. ls: Listing Files • The * indicates the file is an executable code. • The / indicates the file is a directory. • The –a (all) option lists all hidden files. • Hidden files are those beginning with a dot. • Generally, these dot files are startup files for their corresponding commands. $ ls –Fax ./ ../ .Xauthority .cshrc* .cshrc.dec* .cshrc.linux* .cshrc.next* .cshrc.solaris* .cshrc.sun* .login* • . represents the current directory.

  4. ls: Listing Files • .. represents the parent directory. • When ls is used with the directory, it shows the contents of the directory. • The –R (recursive) option lists all files and subdirectories in a directory. • The –l (long) option of ls reveals most attributes of a file – like its permissions, size, and ownership details.

  5. ls –l: List File Attributes kirk> ls -l total 7 drwxr-xr-x 2 cs497c grader 1024 Sep 25 11:30 bin -rw------- 1 cs497c grader 306 Sep 26 11:55 chap3 -rw------- 1 cs497c grader 306 Sep 26 11:55 chap5 drwx------ 2 cs497c grader 1024 Sep 25 14:35 mail drwx------ 2 cs497c grader 1024 Sep 25 18:20 nsmail drwx------ 2 cs497c grader 1024 Sep 26 12:03 prog1 Permissions Links Owner Group size Last Filename Owner Modification Time

  6. ls –l: List File Attributes • The words total 7 indicates a total of 7 blocks are occupied by these files in the disk. • The first column shows the type and permissions associated with each file. • When you create a file, you automatically become its owner. • When opening a user account, the system administrator also assigns the user to some group.

  7. ls –l: List File Attributes • The fourth column stands for the group owner of the file. • The fifth column shows the size of the file in bytes. • The next set of three columns indicates the last modification time of the file. • The last column displays the filenames. • The –d (directory) option force ls to list the directory attributes rather than its contents.

  8. File Permissions $ ls -l chap3 chap5 hello.sh -rw-r--r-- 1 cs497c grader 306 Sep 26 11:55 chap3 -rw------- 1 cs497c grader 306 Sep 26 11:55 chap5 -rwxr-xr-x 1 cs497c grader 20 Sep 27 23:40 hello.sh • The first column represents the file permissions. • r indicates read permission, which means cat will display the file. • w indicates write permission, which means you can edit this file.

  9. File Permissions • x indicates execute permission; the file can be executed as a program. • There are three categories of users: owner, group, and others. owner’s permissions other’s permissions - r w x r - x r - x type of file group’s permissions • The first group (rwx) indicates the file owner can read, write, and execute this file.

  10. File Permissions • The second group (r-x) indicates the group can read and execute the file. • The third group (r-x) indicates others can read and execute the file.

More Related