

This will be showing the last edited file in the last line which will be handy when the listing goes beyond a page.Ĩ. $ ls -ltr : To sort the file names in the last modification time in reverse order. Order Files Based on Last Modified Time (In Reverse Order) Using ls -ltr Ls -lt : To sort the file names displayed in the order of last modification time.You will be finding it handy to use it in combination with -l option.ħ. Order Files Based on Last Modified Time Using ls -lt But, if you want to display the information about the /etc/ directory, use -ld option as shown below.Ħ. But if you want the details of the directory then you can use -d option as., For example, if you use ls -l /etc will display all the files under the etc directory. When you use “ls -l” you will get the details of directories content. Display Directory Information Using ls -ld Ls -lh (h stands for human readable form) : To display file size in easy to read format. Display File Size in Human Readable Format Using ls -lh Field 7 – File name: The last field is the name of the file.In this example, ‘Feb 16 00:19’ specifies the last modification time of the file. Field 6 – Last modified date and time: Sixth field specifies the date and time of the last modification of the file.In this example, ‘1176’ indicates the file size in bytes. Field 5 – Size: Fifth field specifies the size of file in bytes.In this example, this file belongs to ”maverick’ group.


Field 4 – Group: Fourth field specifies the group of the file.In this example, this file is owned by username ‘maverick’. Field 3 – Owner: Third field specifies owner of the file.In this example, 1 indicates only one link to this file. Field 2 – Number of links: Second field specifies the number of links for that file.If all three permissions are given to user(root), group and others, the format looks like -rwxrwxrwx Taking above example, -rw-rw-r– indicates read-write permission for user(root), read permission for group, and no permission for others respectively. The every 3 characters specifies read, write, execute permissions for user(root), group and others respectively in order. Field 1 – File Permissions: Next 9 character specifies the files permission.Following are the possible file type options in the 1st character of the ls -l output. In the example above the hyphen (-) in the 1st character indicates that this is a normal file. rw-rw-r– 1 maverick maverick 1176 Feb 16 00:19 1.cġst Character – File Type: First character specifies the type of the file. $ ls -l : To show long listing information about the file/directory. Display All Information About Files/Directories Using ls -l head -1 picks up this first file.To open the last edited file in the current directory use the combination of ls and head commands as shown below.ģ. Ls -t : It sorts the file by modification time, showing the last edited file first. ISRO CS Syllabus for Scientist/Engineer Exam.ISRO CS Original Papers and Official Keys.GATE CS Original Papers and Official Keys.
