I don't know anything about Unix/Linux. I am primarily a web programmer. I am running the following command in my code: exec(&quot;tar -caf '/backups/_structure.tar.gz' --ignore-failed-read -C /source .&quot;);  This code makes a file backup of all the contents of my /source directory and stores it in the /backup directory. This code works fine, except for the fact that sometimes my files are HUGE. I would like to split the tar file by 100MB segments. In this single line, what would I add to do that? I've read some things about | split -b 100MB, but I don't know where in the line to put it and I'm very confused.
14212
I need to backup a fairly large directory, but I am limited by the size of individual files. I'd like to essentially create a tar.(gz|bz2) archive which is split into 200MB maximum archives. Clonezilla does something similar to this by splitting image backups named like so:  sda1.backup.tar.gz.aa sda1.backup.tar.gz.ab sda1.backup.tar.gz.ac   Is there a way I can do this in one command? I understand how to use the split command, but I'd like to not have to create one giant archive, then split it into smaller archives, as this would double the disk space I'd need in order to initially create the archive.
22333
When administering Linux systems I often find myself struggling to track down the culprit after a partition goes full. I normally use du / | sort -nr but on a large filesystem this takes a long time before any results are returned.  Also, this is usually successful in highlighting the worst offender but I've often found myself resorting to du without the sort in more subtle cases and then had to trawl through the output.  I'd prefer a command line solution which relies on standard Linux commands since I have to administer quite a few systems and installing new software is a hassle (especially when out of disk space!)
39509
I received a huge .tar.gz file from a client that contains about 800 mb of image files (when uncompressed.) Our hosting company's ftp is seriously slow, so extracting all the files locally and sending them up via ftp isn't practical. I was able to ftp the .tar.gz file to our hosting site, but when I ssh into my directory and try using unzip, it gives me this error:  [esthers@clients locations]$ unzip community_images.tar.gz Archive:  community_images.tar.gz   End-of-central-directory signature not found.  Either this file is not a zipfile, or it constitutes one disk of a multi-part archive.  In the latter case the central directory and zipfile comment will be found on the last disk(s) of this archive. note:  community_images.tar.gz may be a plain executable, not an archive unzip:  cannot find zipfile directory in one of community_images.tar.gz or community_images.tar.gz.zip, and cannot find community_images.tar.gz.ZIP, period.   What command do I need to use to extract all the files in a .tar.gz file?
109222
I am able to use the split command successfully to split large file into multiple smaller files. This is being achieved by following command  split -b 1G $temp_path $final_filepath   But only caveat is that these files many times contain last line which is split across 2 files. Is there any way to avoid that using split or any other command ?
109072
This is more a conceptual thing than a current problem.  Would it be possible to do this:  tail -f &lt;file&gt; | grep "string" | sed 's/stuff//g' &gt;&gt; output.txt  The problem I'm thinking is that tail -f never terminates so it won't progress in the command. I'm trying to read and output a file in real-time. If this doesn't work how would I do it?
60052
If I'm installing from source, do I need to keep the extracted tarball directory?  So if I download the git tarball. I then do:  tar -xvzf git.tar.gz   This will create a git.x.x. directory, into which I cd, then run ./configure etc. Once I'm done with this process, and git, or whatever is installed, do I need to keep the original git.x.x extracted directory, or is that just used for compiling the program?  I'm somewhat confused by all the directories, and folders used for programs.
82137
On Windows/DOS terminals a cd.. correctly change the directory.  On Linux terminals the dots from the cd command have to be separated. I'd like to know how/why is this necessary for the parser to work. If no space is added then the command is not understood.   This works well   cd ..   This does not work  cd..   Probably the regExp or whatever is parsing the commands is not including the dot as a possible character immediately after the command.
78717
I need to search for a file inside a tar.gz file without extracting it. After that, I need to copy the file that was searched (if ever there is) to another folder.  So far I have this, but the copy part of this line gives me an error.  gunzip -c file.tar.gz | tar tvf - | grep filename | -exec cp {} /folder/another_folder \;   Or is there a better way to search for a file inside a tar.gz file without extracting it?
13333
I need to display whole file before tracking it for a new changes, not only the last 10 lines (yep, I know it's not tail conceptually). In other words, something like cat -f would do, if it would ever existed. Tail's man doesn't give me any ideas. The only option I see right now is to somehow combine cat all but last 10 lines and tail -f output.  Any hints, please?
50273
Is there a utility that split file by newline symbol? e.g if a file contains the following lines,  aa bbb cccc   If I want to split it to 3 files, the desired output would be:  aa, bbb And cccc (in 3 different files)  I already checked the split command, it only cut file by file sizes, not what I want.  If I don't wrote a utility myself, is there any standard tool to use?
24944
I've already copied terabytes of files with rsync but I forgot to use --archive to preserve files' special attributes.  I tried executing rsync again this time with --archive but it was way slower than what I expected. Is there any easy way to do this faster by just copying metadata recursively?
34502
I have backups up everything, but I'm still uneasy about the process and would like confirmation. I'd rather do this one time correctly. I want to shrink /dev/sda6/ by 200GB and reallocate it to /dev/sda2. I boot a LiveCD and turn off LinuxSwap (locked otherwise). I've been reading that it is very hard to move &quot;left&quot; when partitioning and other AskUbuntu threads are confusing me. Do I need to resize /dev/sda6 by 200GB &quot;preceding&quot; (rather than &quot;following&quot;), and then resize /dev/sda4 by 200GB? A little guidance would ease my nerves of messing everything up. Thank you ahead of time.
101503
How do I break a large, +4GB file into smaller files of about 500MB each.   And how do I re-assemble them again to get the original file?
33546
I'm trying to move some data over and to start with I'd like to make sure that the size is ok. I run into a problem however, if I check the folder with   du -sh  myfolder/ 780M    myfolder/   but   du -sh * .. 71M     myfolder ..   I thought it might be something to do with hidden files but this particular folder does not have any inside.  Am I missing something?
98499
I'm looking for a very basic backup script/package for a directory on my Ubuntu server. Currently I'm using a cronjob like this:  0 5 * * 1 sudo tar -Pzcf /var/backups/home.tgz /home/   But I want a solution which adds a timestamp to the filename and does not override old backups. Of course this will slowly flood my drive so old backups (e.g. older than 2 months) need to be deleted automatically.  Cheers, Dennis    UPDATE: I've decided to give the bounty to the logrotate-solution because of it's simplicity. But big thanks to all other answerers, too!
41756
I'm trying to compress a folder (/var/www/) to ~/www_backups/$time.tar where $time is the current date.  This is what I have:  cd /var/www &amp;&amp; sudo tar -czf ~/www_backups $time"   I am completely lost and I've been at this for hours now. Not sure if -czf is correct. I simply want to copy all of the content in /var/www into a $time.tar file, and I want to maintain the file permissions for all of the files. Can anyone help me out?
8430
I'm not well versed in shell scripting but I imagine this to be a painfully easy fix but its eluding me.  I need to copy the contents of a directory excluding a number of files. I have a command that works when I enter it into the terminal, but when its run in a shell script it fails with a syntax error or just doesn't work.   The command in question is:  cp -r path/to/!(dir1|dir2|dir3) destination   Any help would be greatly appreciated!