Storage Commands :-
Compress :- You can use this command to reduce the size of a file.
Has a .Z appended to its name.
The compressed file retains the permi & time attributes of the original file.
Cpio:- You can use this command to copy files to archival medium from disk or to
restore files from archival medium to disk.
There are three major forms of this cpio command.
(1) cpio –o to read standard input for path names & copy them to standard o/p.
(2) cpio –i to read from standard input archival files & create disk files.
(3) cpio –p to read standard input for the pathname & copy to the specified
directory.
Flag :-
d :- Create a directory if the specified directory does not exist.
f :- Copy files that do not match the specified pathname.
r:- Copy files interacting with the option of modifying the filename
t :- Create a list of files without actually copying a file.
u :- Overwrite a file if it already exist.
v:- List the filenames being copied.
Example :- (1) If you have a list of files that you want to copy to a diskfile.
Ls *.txt | cpio –ov > /dev/rfd0
This example copies all files that have an extension of *.txt
(2) If you want to copy all files from the current directory as well as the
Files in its subdirectories , use the –p flag.Additionally, you can use the –d flag .so that all
the needed directories are created.
Find –print | cpio –pd /u/testuser/cpiodir
DD :- can be used to read data from the std. Input & copy it to the std. O/p after converting data
according to specified conversion parameters.
Flags :-
if=filename Specify the input filename to be copied.
of=filename Specify the output filename to be created.
files=filename Specify the no. of files to be copied ( such as from a tape containing
multiple files)
conv=conversion parameter Specify the type of conversion to be used. Some of the values
of this parameter can be ASCII,EBCDIC,block,unblock,lcase
and ucase.
Example :-
(1) If you have a file from a system that stores data in EBCDIC format & U want to
Convert the data to ASCII.
dd if=file1 of=file2 conv=ASCII
(2) If you want to copy file1 on disk to a tape with a block size of 1024,
dd if=file1 of=/dev/rmt0 bs=1024 conv=syne.
Pack:- if U want to save disk space,use the pack command to compress a file in a way similar to the
Compress command.
- Generates new file with .z appended to the filename.
- The original file is removed.
- Get 30% to 59% compress for text files.
Flag:-
-f force packing
Ex. Pack file1.
Pcat:- can be used to uncompress a file to the std. O/p.
Ex. With pack command file1.2 then
Pcat file1.2
Tar :- it is used to copy files from disk to an archival medium ( usually tape) or vice-versa.
:- The tar command does not provide any recovery from tap emors.
Flag :-
-c Create a new archive & write the file details at the begging of the archieve.
-t generates a list of files in the archieve.
-x Obtain one or more files from an archieve.
If you specify a directory name -> all the files in the directory are extracted.
If no file on directory is specified, all the files in the specified archive are extracted.
-p Restore the files with their original permition, ignoring the current setting of the umask.
-f archive : Use the specified archive as the archive name istead of the system default.
-v Display the name of each file as it is processed.
Examples:-
(1) If you want to extract all the files in the /u/testuser directory from the archive file on the
/dev/emt1 tape device.
tar –xvt /dev/rmt1 /u/testuser
(2) If U want to archive a file to an archive on the default tape drive,
tar drive ,tar –c file1
Uncompress:- can be ued to uncompress a file that has earlier been compressed using the compress
Command .
Umcompress file1.2
Unpack :- can be used to uncompress files that have the .z extention & that have been compressed
using the pack command.
Unpack file1.2 >file2
Status Commands:-
Date:- used to display the current date and time in a specified format.
Env :- can be used to display the current environment or to chane one or more of the ENV
Variables. And run a specified command.
Flag:-
-i to indicate that only the variables setup as part of the env. Command are used for
specified command.; all the current variables setups are ignored.
Example :-
(1) assumed that my job script that displays the current setting of the Env variables
called ZANG.
If U execute the script my job as a part of the ENV command without modifying the
LANG variable.
Env path=/u/testuser/jobs : $path my job LANG=c
If U modify the LANG variable as a part of the Env command
Env LANG=c++ path=/u/testuser/jobs : $path my job LANG=c++
Iostat:- can be used to obtain statistics about the cpu ; clicks & tty of a system.
Display the following details:-
tty and cpu header.
Tty and cpu statistics detail
physical volume header.
One line for each physical value.
Sar :- to get a report about system information by definition generates the CPU Utililzation
Report. But U can use various flags to collect information about other system activities.
Flags:-
-A report data on all system activities.
-a reports data on a use of the file system access reactive.
-b report buffer activities.
-c report system calls such as forks ,access & so on…..
-f file Extract data from the specified file.
-k report on kernel activity.
-m report on semaphore & message activity.
-o file save the activity data in the specified file.
-r report on paging statistics.
-v report on process and I-node activity.
-y report on TTY activity.
UNAME:- Display details about the O/S and computer system on the std. O/P.
Flag:-
-m Display the machine ID.
-r Display the release number of O/S.
-s Display the system name.
-v Display the O/S version.
-S name Modify the system name.
-a Display the machine ID, the release number of the O/S ,System name.
Uptime:- display the following the information.
the current time
the length of a time, the system has been up
the no. of users currently logged on.
The no. of jobs executing in the system
Vmstat:- can be used to get information about the processes virtual memeory, physical
Volumes , and CPU activity include CPU utilization , virtual memory and physical
Volume. This information can be used to monitor the load on the system.
Details displayed by vmstat are as follows:
Processes (1) r (2) b
Virtual memory (1) avm (2) fre
Page (1) re (2) pi (3) po (4) fr (5) sr (6) cy
Faults (1) in (2) sy (3) cs
Cpu (1) us (2) sy (3) id (4) wa
Example :- If U want to statistics five times in interval of the five seconds.
Vmstat 5 5 ‘