LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   does this seem correct to you? (https://www.linuxquestions.org/questions/linux-newbie-8/does-this-seem-correct-to-you-4175588412/)

sigint-ninja 08-31-2016 09:39 AM

does this seem correct to you?
 
Type tar xjvf homes.tar /home . This creates a compressed archive of the home directory to the home directory of user root.

HMW 08-31-2016 09:46 AM

Quote:

Originally Posted by sigint-ninja (Post 5598761)
Type tar xjvf homes.tar /home . This creates a compressed archive of the home directory to the home directory of user root.

No. Note the 'x' in the command.

To create and compress use 'c'. Like so:
Code:

tar -cjvf compressed_files.tar /path/to/file(s)
From tar man page:
Code:

    -x, --extract, --get
          extract files from an archive

[...]

EXAMPLES
    Create archive.tar from files foo and bar.
          tar -cf archive.tar foo bar
    List all files in archive.tar verbosely.
          tar -tvf archive.tar
    Extract all files from archive.tar.
          tar -xf archive.tar




Best regards,
HMW

schneidz 08-31-2016 10:10 AM

also roots $home is in /root (not /home)

HMW 08-31-2016 12:33 PM

Quote:

Originally Posted by schneidz (Post 5598774)
also roots $home is in /root (not /home)

Yes, this is also true.

Rinndalir 08-31-2016 02:26 PM

Depends on whether or not you're in the home directory of user root or not.
homes.tar.bz2 will be created in the current directory.

Should be
Code:


tar cjvf homes.tar.bz2 /home


If that "." was part of the command it would be a mistake.


All times are GMT -5. The time now is 08:10 AM.