background preloader

Commands

Facebook Twitter

How to Backup Linux? 15 rsync Command Examples. Rsync stands for remote sync. rsync is used to perform the backup operation in UNIX / Linux. rsync utility is used to synchronize the files and directories from one location to another in an effective way. Backup location could be on local server or on remote server.

Important features of rsync Speed: First time, rsync replicates the whole content between the source and destination directories. Syntax $ rsync options source destination Source and destination could be either local or remote. Example 1. To sync two directories in a local computer, use the following rsync -zvr command. $ rsync -zvr /var/opt/installation/inventory/ /root/temp building file list ... done sva.xml svB.xml . sent 26385 bytes received 1098 bytes 54966.00 bytes/sec total size is 44867 speedup is 1.63 $ In the above rsync example: -z is to enable compression -v verbose -r indicates recursive Now let us see the timestamp on one of the files that was copied from source to destination.

Example 2. Example 3. Example 4. Courses Available — Novell. Sed. 50 Most Frequently Used UNIX / Linux Commands (With Examples) This article provides practical examples for 50 most frequently used commands in Linux / UNIX. This is not a comprehensive list by any means, but this should give you a jumpstart on some of the common Linux commands. Bookmark this article for your future reference. Did I miss any frequently used Linux commands? Leave a comment and let me know. 1. tar command examples Create a new tar archive. $ tar cvf archive_name.tar dirname/ Extract from an existing tar archive. $ tar xvf archive_name.tar View an existing tar archive. $ tar tvf archive_name.tar More tar examples: The Ultimate Tar Command Tutorial with 10 Practical Examples 2. grep command examples Search for a given string in a file (case in-sensitive search). $ grep -i "the" demo_file Print the matched line, along with the 3 lines after it. $ grep -A 3 -i "example" demo_text Search for a given string in all files recursively $ grep -r "ramesh" * More grep examples: Get a Grip on the Grep!

3. find command examples # find -iname "MyCProgram.c" $ awk '! Daddy, I found it!, 15 Awesome Linux Find Command Examples (Part2) A while back we reviewed 15 practical find command examples (Part I). Find command can do lot more than just searching for files based on name. In this article (Part 2), let us discuss 15 advanced examples of find command including — finding files based on the time it is accessed, modified or changed, finding files comparatively, performing operation on found files etc., Ramesh Natarajan: That is my sweet little daughter in that picture. She was very happy to spot the sea lion in the California Long Beach Aquarium. Find Files Based on Access / Modification / Change Time You can find files based on following three file time attribute.

Access time of the file. In the following examples, the difference between the min option and the time option is the argument. min argument treats its argument as minutes. Example 1: Find files whose content got updated within last 1 hour To find the files based up on the content modification time, the option -mmin, and -mtime is used. . # find. . # find . Mommy, I found it! — 15 Practical Linux Find Command Examples. Apart from the basic operation of looking for files under a directory structure, you can also perform several practical operations using find command that will make your command line journey easy. In this article, let us review 15 practical examples of Linux find command that will be very useful to both newbies and experts.

First, create the following sample empty files under your home directory to try some of the find command examples mentioned below. # vim create_sample_files.sh touch MybashProgram.sh touch mycprogram.c touch MyCProgram.c touch Program.c mkdir backup cd backup touch MybashProgram.sh touch mycprogram.c touch MyCProgram.c touch Program.c # chmod +x create_sample_files.sh # . /create_sample_files.sh # ls -R .: backup MybashProgram.sh MyCProgram.c create_sample_files.sh mycprogram.c Program.c .

/backup: MybashProgram.sh mycprogram.c MyCProgram.c Program.c 1. This is a basic usage of the find command. . # find -name "MyCProgram.c" . 2. . # find -iname "MyCProgram.c" . 3. 4. 5. Command line reference. Learn Basic Linux Command Step by Step Example | Learn Linux Command with Step by Step Example Approach. Linux Commands.