【+20 Linux Backup Commands】List ▷ 2022

If unexpectedly, a computer failure occurs that renders the hard drive useless, The best way to get ahead is to have a backup that allows you to recover your files, especially the most vital ones. For this reason, regardless of the level of knowledge we have about computers, we must learn to make backups of stored information.

But when it comes to do jobs by commands, there are those who immediately put up a barrier and think that they will not be able to do it. The good news is that the task is easy to perform and configure, just by following a few simple steps.

In this grade You will know all the commands that are used to make backup copies like an expert, but we will also show you the programs that can help you make backups effectively and professionally.

List of the best commands to make backups from the Linux terminal like an expert

Every Linux command has a specific function and a particular language that allows them to perform the tasks for which they were designed. And while distributions are becoming simpler and easier to use, using the terminal is a powerful tool that shouldn’t be wasted.

In the following list we will know the commands that are useful for making backup copies, either on a removable device, on the local computer or remotely:

dump -0aj -f /tmp/home0.bak /home

The goal of this command is to save the entire directory “home“, which is where the user files are stored.”dump“determines which documents can be copied, the letter “–F” tells us where the selected file is going to be saved and the “0” indicates that a full copy will be performed.

  • To carry out the task without many complications, it is enough that enter this command in the terminal: dump -0aj -f /tmp/home0.bak /home

dump -1aj -f /tmp/home0.bak /home

In this case, the tool appears again dumpbut with a “-1” to imply that the copy is incremental, which means that the files have been created recently or that they have undergone some modification. The “-F” which goes in the command commands the place where the backup will be saved.

  • To save the files, open the terminal and type this code: dump -1aj -f /tmp/home0.bak /home

restore -if /tmp/home0.bak

restore has the function of restoring the files that have been generated with dumpSo both tools work hand in hand. The letters “–if” They refer to entering interactive mode, but also specifying the file to be retrieved. When the file is required again, it is restored with the attributes it contains.

  • When you have to restore, Enter the terminal and type: restore -if /tmp/home0.bak
See also  【MEGADEDE closes? 】How to enter? + Alternatives + List ▷ 2022

rsync -rogpav –delete /home /tmp

“rsync” It represents remote synchronization and gives the option of coupling the files on the computer with others that are on the same network or on others. Directories being paired, backup copies are facilitated as is moving items back and forth.

  • Synchronization works with just enter this code: rsync -rogpav –delete /home /tmp

rsync -rogpav -e ssh –delete /home ip_address:/tmp

In this case, the code is necessary when we have to connect to a computer that has “SSH” but with a port “TCP” different from the one that is traditionally used, which is 22. For this reason, you note in the command the parameter “-and” that allows you to use the protocol for the transfer of information. In this way, nobody will be able to take your data because the connection is encrypted.

  • just stop To use the data transfer protocol enter this line: rsync -rogpav -e ssh –delete /home ip_address:/tmp

rsync -az -e ssh –delete ip_addr:/home/public /home/local

The job of this command is to synchronize the local directory with the remote one also using the “SSH”. Running this function saves time and if you lose connection due to technical issues, the transfer resumes right where it left off. The letters “az” that appear in the code indicate that the files are compressed to speed up the speed.

  • The synchronization will be effective with this code: rsync -az -e ssh –delete ip_addr:/home/public /home/local

rsync -az -e ssh –delete /home/local ip_addr:/home/public

Here the task is similar to the previous one, with the difference that we are going to synchronize the remote computer with the one we have locally. We will also use compression so that communication flows better. This is ordered with the use of the parameters “az”, which enable the files and compress them during transfer.

  • Once you open the terminal, add this line: rsync -az -e ssh –delete /home/local ip_addr:/home/public

dd bs=1M if=/dev/hda | gzip | ssh user@ip_addr ‘dd of=hda.gz’

The tool “dd” It will help us make backup copies of the computer’s hard drive(s). abbreviations “if” In this case, they represent the place where the data comes from, so you must not make a mistake in the selection, as this will cause a malfunction.

  • Just copy this line in the terminal to make the copy: dd bs=1M if=/dev/hda | gzip | ssh user@ip_addr ‘dd of=hda.gz

dd if=/dev/sda of=/tmp/file1

Again we use the command “dd” but with the intention of passing the contents of a hard drive to a particular destination. The combination “if” represents what you want to copy and “of” where they will be archived. The unit is represented by “sda” and the storage where it goes is the file by “file1”.

  • To perform this task, add this command: dd if=/dev/sda of=/tmp/file1
See also  【Arduino Digital Outputs】What are they? + How They Work ▷ 2022

tar -Poof backup.tar /home/user

This extension allows back up data and files that have been modified or created since the last time you made the backup, this means that everything will not be saved again, making the transfer shorter.

  • With this command you achieve the objective: tar -Poof backup.tar /home/user

tar -czv –exclude=/root/dir1/* -f /var/salvas/cfg_$(date +%F_%H%M).tgz /etc /root

The described code creates a compressed file in which the directories are saved. “etc” Y root that contain the time the backup is taking place. The combination “–czv” order the creation of the file “tar” compressed and at the same time shows the progress of the conversion.

  • To create the compressed file, enter this command to the terminal: tar -czv –exclude=/root/dir1/* -f /var/salvas/cfg_$(date +%F_%H%M).tgz /etc /root

(cd /tmp/local/ && tar c . ) | ssh -C user@ip_addr ‘cd /home/share/ && tar x -p’

By entering this command, the contents of a local directory will be backed up in another located on a remote computer, but using “SSH”. This utility changes the position within the file system to a higher or lower position and comes by default in all Linux distributions.

  • If you have to make a backup, it will be enough to enter this command to the terminal: (cd /tmp/local/ && tar c . ) | ssh -C user@ip_addr ‘cd /home/share/ && tar x -p’

(tar c /home ) | ssh -C user@ip_addr ‘cd /home/backup-home && tar x -p’

Like the previous command, offers the opportunity to copy files to a remote directory using “SSH”. The “c” tells the system to create a new file “tar” in which the documents will be saved.

  • In order not to fail in the attempt, open terminal and copy this: (tar c /home ) | ssh -C user@ip_addr ‘cd /home/backup-home && tar x -p’

tar cf – . | (cd /tmp/backup ; tar xf – )

It is useful if you want to group all the text documents in one file “.tar” but with the possibility of keeping both the licenses and the links when transferring them to another directory.

  • It is very easy to do, just type this command: tar cf – . | (cd /tmp/backup ; tar xf – )

find/home/user1 -name ‘*.txt’ | xargs cp -av –target-directory=/home/backup/ –parents

The command find It is used to search, copy and find a user’s files within a directory but based on certain criteria, among other things the format in which it has been saved. In this case it will collect all files with the extension “.tex” to move them from one directory to another.

  • To search the text files, enter this code: find/home/user1 -name ‘*.txt’ | xargs cp -av –target-directory=/home/backup/ –parents

find ~/ -type f -not -iname ‘*.mp*’ -not \( -iregex ‘.*\.mozilla/.*’ -o -iregex ‘.*\.thumbnails/.*’ \) -prune -mtime 14 -print0 | xargs -0 tar -czf /var/salvas/myhome.tgz

This directory is very punctual when executing the tasks. When entering, the files that are in our user account that have been changed or modified in the last two weeks are saved with some exceptions, such as .mp3, .mpeg, and .mozilla.

  • The command to use is this: ‘.*\.mozilla/.*’ -o -iregex ‘.*\.thumbnails/.*’ \) -prune -mtime 14 -print0 | xargs -0 tar -czf /var/salvas/myhome.tgz
See also  【+10 Voice Assistants for All Devices】List ▷ 2022

find /var/log -name ‘*.log’ | tar cv –files-from=- | bzip2 > log.tar.bz2

Typing this command searches for all files “.log”, which are text files in which the events that occur during the execution of a certain application are recorded. with the command find are bundled together to create a compressed file with the extension “bzip”.

  • Open the terminal and place this command: find /var/log -name ‘*.log’ | tar cv –files-from=- | bzip2 > log.tar.bz2

dd if=/dev/hda of=/dev/fd0 bs=512 count=1

This command makes a copy of the Master Boot Record (“MBR”“) – which is the main boot record of the hard drive and where the partitions are stored – in order to take it to an external storage device. This procedure is very simple and safe.

  • At the time of copying, add this command in terminal: dd if=/dev/hda of=/dev/fd0 bs=512 count=1

dd if=/dev/fd0 of=/dev/hda bs=512 count=1

It allows restore the backup created with the previous commandwhich was saved on an external storage device, either an SD card, a flash drive or hard drive.

  • When it’s time to restore, type this line: dd if=/dev/fd0 of=/dev/hda bs=512 count=1

These are the best programs to make Backups in Linux in an easier way

now we go with some programs that will make it easier to make backup copies in Linux beyond the use of commands.

They are all easy to use and will prevent our data from being lost:

grsync

This is a completely simple program to use. It doesn’t come by default on many operating systems, but it can be easily installed. Its interface is simple and shows in the first tab all the options you have available to make backup copies. One advantage is that the data being copied is not compressedso you don’t have to use additional programs to see them again.

KBackup

This program makes copies of both files and directories on the computer. At no time do you work with the terminal, you always use the graphical interface. You only need to mark one or more files to start…

Loading Facebook Comments ...
Loading Disqus Comments ...