0

May I know that when I run this command:

sudo tar -cvpzf user1_backup-$(date +%Y--%m-%d).tar.gz /home/students/user1

to backup the user1 account in my linux OS, it does backup my home directories of that users, however, does it also backups the user1's system configuration files as well?

By the way, as the command as shown above, besides append date to my backup filename, is it possible for me to append any other names to my backup file? For example, the system files name..

Thanks for your guides!

1 Answer 1

0

The users' system configuration files are usually under the home of each single user.
Those are files and directories often hidden (they start with .).
You should backup even them with that command.

Check with man uname and man hostname to have some useful things to put in the backup filename.

E.g. the line

sudo tar -cvpzf user1_backup.$(hostname).tar.gz /home/students/user1

will give you the filename with the hostname inside.

Often in linux the command uname -o answer with GNU/Linux that will be a problem if used as a part of filename for the character /. I do not have a mac to check what is the answer but I think it's easier/safer and more general to use the hostname.

Note: if you do not have the hostname command and you should have set the variable $HOSTNAME with the hostname inside.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .