Files And Directories
HomeSCJP | SCWCD | SCEA | SCSA
State the commands used to reduce the size of files and directories for storage to tape.
tar is a command to backup individual files and directories.
tar options [ arguments ] files_to_tar
Options include
c - to create,
t - to list table of contents,
f - to specify a filename,
x - to extract files,
v - to print names as they are processed, or
p - restore original permissions.
# tar cvf matt.tar * will create a tar file called matt.tar with all the files in the local directory.
# tar xvf matt.tar    will restore the files from matt.tar to the current directory
To compress files,Solaris now includes the gzip utility. This pgm reduces the size of files to save space. # gzip matt.tar  will compress matt.tar and rename the resulting (smaller) file matt.tar.gz

Match the file types of regular files, directories, symbolic links, device files, and hard links to their respective functions.
Solaris 8 supports all the standard file types that UNIX supports. The four main ones are:
1. regular files - identified by a "-" in the first field of an ls listing
2. directories - identified by a "d" in the first field of an ls listing
3. symbolic links - identified by a "l" in the first field of an ls listing
4. device files - identified by a "b" or "c" in the first field of an ls listing

To understand file types, one must first understand the way records are stored on a disk. Solaris ufs makes use of a record type called an
inode, which contains file information like size, permissions and ownership and pointers to the location of the actual data it contains. Inode numbers are generated when a new file system is created. It is a finite number, meaning that when all the inodes are used up, no more files can be created on the disk. The association between an inode and the filename is called a hard link.
Regular files hold data such as ASCII text, binary machine language, or image data. The file name is associated with an inode, which then points to the data blocks that contain file data.

Directory files do not hold data, but rather point to a list of all files that exist within the directory.

Symbolic links are files that point to other files. The data the link contains is the pathname of the file it represents. Its size is based on the number of characters that make up the pathname to the original file.

Device files do not point to data blocks. Instead, their inode information refers to major and minor numbers. Major numbers describe a specific device driver.
Minor numbers identify the controlling unit type for the device driver.

Device files can be one of two types, character or block.
A character device means that I/O operations on the device are carried out at the smallest addressable unit (sector), which for disks is 512K.
Block device means that I/O operations are carried out on the device based on a
predefined block size.