Join MultiplyOpen a Free ShopSign InHelp
MultiplyLogo
SEARCH

PMana's Sight

Blog EntryNov 23, '11 12:48 AM
for everyone
This post is for my CS162 students, for November 23, 2011.

LAB-02: filedetails.sh
Copyright(c) 2011 by Pablo Manalastas


FILE DETAILS SHELL SCRIPT ASSIGNMENT

PROGRAM DETAILS

Write a shell script "filedetails.sh" that describes
a file as completely as possible.  The command is used as:

./filedetails.sh NAMEOFFILE

If you don't own the file, the command to give is:

sudo ./filedetails.sh NAMEOFFILE

where NAMEOFFILE is the name of the file whose details we want.

If the file does not exist, print "File not found"

For the given file, the output of the command should be:

[For regular files and others:]

File Name:
File Type:
Owner:
Permissions for Owner:
Group:
Permissions for Group:
Permissions for Others:
Actual size:
Size on Disk:
Inode No.:
N of Links/Filenames:
Access Date/Time:
Modify Date/Time:
Change Date/Time:
First 128 bytes: (Using od -bc)

[For device files:]

File Name:
File Type:
Owner:
Permissions for Owner:
Group:
Permissions for Group:
Permissions for Others:
Block or Char?
Device Major:
Device Minor:
Inode No.:

[For Symbolic Links:]

File Name:
File Type:
Link to Pathname? //what is it linked to?

[For Directories, Pipes, and Sockets:]

File Name:
File Type:
Owner:
Permissions for Owner:
Group:
Permissions for Group:
Permissions for Others:
Inode No.:
N of Links:
Access Date/Time:
Modify Date/Time:
Change Date/Time:

References

1. man stat
2. man ls


0 Comments
Add a Comment