Amri
Amri

Reputation:

What does "tar -cvf /dev/nst0 /home/user1 >> file1.log" do?

I need help to understand the following command.

tar -cvf /dev/nst0 /home/user1 >> file1.log

Upvotes: 1

Views: 2128

Answers (2)

Vincent De Baere
Vincent De Baere

Reputation: 617

In addition to shodanex's answer: this creates a tar archive, written to /dev/nst0 (a tape drive?) from /home/user1 and appends the output (remember verbose -v) to file1.log

Upvotes: 1

shodanex
shodanex

Reputation: 15406

Read the man page :

-c stands for create
-v is for verbose
-f specify the archive name

And tar -cvf is equivalent to tar -c -v -f, so what this is doing is creating an archive of /home/user1 into /dev/nst0. The >> file1.log is redirecting and appending the standard output to file1.log. tar -cvf archive_name [files] > file.log would erase any existing content in file1.log

Have a look here for an explanation on I/O redirection

Upvotes: 1

Related Questions