- Connect to a shell or open a terminal/console on your Linux/Unix machine.
- To create an archive of a directory and its contents you would type the following and press enter:
- tar -cvf name.tar /path/to/directory
Substitute the name.tar with the name of the tar file you would like to create and substitute the directory name for the full path to the directory you would like to archive.
- tar -cvf name.tar /path/to/directory
- To create an archive of certfain files you would type the following and press enter:
- tar -cvf name.tar /path/to/file1 /path/to/file2 /path/to/file3
Substitute the name.tar with the name of the tar file you would like to create and substitute the the various files for the full path to the files you would like to archive. Each file you would like included in the archive should be seperated by a space.
- tar -cvf name.tar /path/to/file1 /path/to/file2 /path/to/file3
W e will discuss in detail about special variable in Unix. In one of our previous chapters, we understood how to be careful when we use certain nonalphanumeric characters in variable names. This is because those characters are used in the names of special Unix variables. These variables are reserved for specific functions. For example, the $ character represents the process ID number, or PID, of the current shell − $echo $$ The above command writes the PID of the current shell − 29949 The following table shows a number of special variables that you can use in your shell scripts − Command-Line Arguments The command-line arguments $1, $2, $3, ...$9 are positional parameters, with $0 pointing to the actual command, program, shell script, or function and $1, $2, $3, ...$9 as the arguments to the command. Following script uses various special variables related to the command line − #!/bin/sh echo "File Name: $0" echo "First Parameter : $1" echo "Second Parameter :...
Comments
Post a Comment