星期五 四月 25, 2008

Identifying File Types


In this demo, you complete the following tasks:


1.Navigate within the directory hierarchy


2.Identify different types of files


Complete the following steps:
1. Log in as the root user, and open a terminal window. In the / (root)
directory, perform a long listing, and record the name of the first
symbolic link listed.


# cd /
# ls -l


2. What is the size in bytes of the link you found in Step 1? How many
characters are there in the name of the file to which this link points?
The /bin symbolic link contains 9 bytes of data and points to ./usr/bin.


3. Change to the /dev/dsk directory. Record the file types that you find
in this directory.


# cd /dev/dsk


4. Use the appropriate options of the ls command to display
information for the files referenced by the files in the /dev/dsk
directory. Record the file types reported.


# ls -lL


5. Change to the /dev/pts directory, and use the same commands you
used in Steps 3 and 4 for the /dev/dsk directory. Record the file
types you find.


# cd /dev/pts
# ls -l
# ls -lL


6. Change to the /etc/init.d directory, and identify the type of file in
this directory.


# cd /etc/init.d ; ls -l


7. How many hard links are associated with the /etc/init.d/volmgt
file? What is the inode number associated with this file?
# ls -li volmgt


8. Find the number of files in the /etc directory or below that have the
same inode number as that used by the /etc/init.d/volmgt file. In
this example, the inode number is 21449.
# ls -i /etc/init.d/volmgt
21449 -rwxr--r-- 6 root sys 473 Sep 3 15:37 volmgt


# find /etc -inum 21449 -exec ls -i {} \;


9. Create a new directory called /testdir. Create a file in this directory
called file1.


# mkdir /testdir
# cd /testdir
# touch file1
# ln -s file1 link1


10. List file1 and the link1 symbolic link. Do these files use the same
or different inodes?
# ls -li


11. In the /testdir directory, create a new directory called newdir.


# mkdir newdir
# ls -ldi newdir


12. List all files, including hidden files, that exist in the newdir
directory.


# ls -lia newdir


13. Create a new directory called dir2 below the newdir directory. What
happens to the link count for the newdir directory?


# mkdir newdir/dir2
# ls -ldi newdir


14. Use the ls command with appropriate options to find the new file
name that uses the same inode as the newdir directory. Record the
name of the new file.


# ls -laRi newdir


 

评论:

发表一条评论:
  • HTML语法: 禁用