how to tar a directory in a sun solaris?

i have lot of directories which are needed to be transferred to a LINUX workstation. to do this i need to tar the directories. please let me know how to tar the directories in Sun Solaris.

Wear outdoor clothes, grab a big black brush, and

tar cf /tmp/directories.tar name of directories

where /tmp/directories.tar is the name of the tar file you want to create, and names, of, and directories are, well, names of directories.

Usually you will also want to gzip or bzip2 compress the tar file; some tar commands even have built-in options to do that at the same time as creating the tar archive. Consult your local manual page for the gory details.

thanks for the help.

but it says 'permission denied'. Do you think it is a administrative privilage problem?

also could ypu please tell me how to untar the file in a specified directory?

1) Yes it is an administrative privilage problem.
2) Use man to see how to use tar.

Make sure you tar these directories up using relative links
eg

cd /some/dir/here
tar cf /path/to/tarball.tar subdir1 subdir2 subdir3/onlythispart

rather than

tar cf /path/to/tarball.tar /some/dir/here/subdir1 /some/dir/here/subdir2 ...

When you untar them again, change into the directory you want them to go to, then run the tar xf to unpack.
By default tar extracts files into the cirrent dir - unless you have used absolute paths when creating the tar, in which case it depends on the implementation of tar as to what it will do.

tar xvf {filename} will tar the file in current directory.
If you want to extract in some other directory, cd to that directory and type
tar xvf {PATH}/{filename}
and the untarred file will be created in pwd

actually I just want to add. For safety reasons whenever you tar anything always try to have the practice to specify relative instead of absolute path.

example:
absolute path will be tar cf /tmp/abc.tar /etc
relative path will be tar cf /tmp/xyz.tar ./etc <-- "."

The danger of using absolute path is when you un-tar the file it will overwrite existing folder.

example:
cd /tmp
tar xf abc.tar will extract and overwrite existing /etc
tar xf xyz.tar will extract into /tmp only