10-01-2006
Yes you can. Use the find(1) command to generate a list of files that have been modified in the last day and use that as input to the tar(1) command. Let's assume you're in your home directory:
$ mkdir backup
$ tar cvf backup/20061001.tar `find . -type f -mtime -1 -print`
If you run this command multiple times in a day, it could find your previous backups, so you might add a grep(1) filter to remove your backups:
$ tar cvf backup/20061001.tar `find . -type f -mtime -1 -print | grep -v "^./backup/"`
8 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
Howdy,
I'm trying to tar some directories to tape and then extract them from tape on another machine. I was hoping someone could help me with the syntax of the tar commands. Both machines are running Solaris 8.
Need to get all files and directories under the following:
... (6 Replies)
Discussion started by: pmetal
6 Replies
2. UNIX for Dummies Questions & Answers
I am trying to write a shell script to look at log files with dates in the file name.
Now I know how to use the expr command to subtract 1 day from the other, which is simple when the dates are from the 2nd to the 31st of each month.
But the problem I have is when the date turns to the 1st... (4 Replies)
Discussion started by: cfoxwell
4 Replies
3. AIX
Hello
Im trying to extract this file
tar -xvf opt-samba-base.tar.tar
tar: 0511-169 A directory checksum error on media; 0 not equal to 75420.
but I get that message
I tried algo with gunzip and uncompress but nothing happens
gunzip -d opt-samba-base.tar.tar
gunzip:... (2 Replies)
Discussion started by: lo-lp-kl
2 Replies
4. Shell Programming and Scripting
Hi Guys,
My unix is SunOS. I like to find all the files which are created 1 day back.
i tried the following command
find . -type f -name '*.aud' -mtime +1
This gives me all the files created 48 hours back (2 days) but not one..
Can you let me know where i am going wrong.
Thanks,... (8 Replies)
Discussion started by: mac4rfree
8 Replies
5. Shell Programming and Scripting
Hi all,
I have a tar file and inside that tar file is a folder with additional tar.gz files. What I want to do is look inside the first tar file and then find the second tar file I'm looking for, look inside that tar.gz file to find a certain directory. I'm encountering issues by trying to... (1 Reply)
Discussion started by: bashnewbee
1 Replies
6. UNIX for Dummies Questions & Answers
$ touch x y
$ ls -l x y
-rw-r--r-- 1 g660 0 Sep 26 03:38 x
-rw-r--r-- 1 g660 0 Sep 26 03:38 y
$ chmod 777 x y
$ ls -l x y
-rwxrwxrwx 1 g660 0 Sep 26 03:38 x
-rwxrwxrwx 1 g660 0 Sep 26 03:38 y
$ rm a.tar
$ tar cvzf a.tar.gz .
./
./x
./y
./a.tar.gz
$ ls -l
total 4
-rw-r--r-- 1 ... (3 Replies)
Discussion started by: volbod
3 Replies
7. UNIX for Dummies Questions & Answers
Hi All,
I have a requirement where I need to first capture the current day & move all the files from a particular directory based on a previous day.
i.e move all the files from one directory to another based on current day & a previous day. Here is what I am trying, but it gives me errors.... (2 Replies)
Discussion started by: dsfreddie
2 Replies
8. Shell Programming and Scripting
Hi,
I need some help writing a perl script to tar all log file to a directory and then delete the log files. Can some one please help me on this? I m Not very good with perl scripting...
Thanks
KK (4 Replies)
Discussion started by: karthikk0508
4 Replies
LEARN ABOUT OSX
procsystime
procsystime(1m) USER COMMANDS procsystime(1m)
NAME
procsystime - analyse system call times. Uses DTrace.
SYNOPSIS
procsystime [-acehoT] [ -p PID | -n name | command ]
DESCRIPTION
procsystime prints details on system call times for processes, both the elapsed times and on-cpu times can be printed.
The elapsed times are interesting, to help identify syscalls that take some time to complete (during which the process may have slept). CPU
time helps us identify syscalls that are consuming CPU cycles to run.
Since this uses DTrace, only users with root privileges can run this command.
OPTIONS
-a print all data
-c print syscall counts
-e print elapsed times, ns
-o print CPU times, ns
-T print totals
-p PID examine this PID
-n name
examine processes which have this name
EXAMPLES
Print elapsed times for PID 1871,
# procsystime -p 1871
Print elapsed times for processes called "tar",
# procsystime -n tar
Print CPU times for "tar" processes,
# procsystime -on tar
Print syscall counts for "tar" processes,
# procsystime -cn tar
Print elapsed and CPU times for "tar" processes,
# procsystime -eon tar
print all details for "bash" processes,
# procsystime -aTn bash
run and print details for "df -h",
# procsystime df -h
FIELDS
SYSCALL
System call name
TIME (ns)
Total time, nanoseconds
COUNT Number of occurrences
DOCUMENTATION
See the DTraceToolkit for further documentation under the Docs directory. The DTraceToolkit docs may include full worked examples with ver-
bose descriptions explaining the output.
EXIT
procsystime will sample until Ctrl-C is hit.
AUTHOR
Brendan Gregg [Sydney, Australia]
SEE ALSO
dtruss(1M), dtrace(1M), truss(1)
version 1.00 Sep 22, 2005 procsystime(1m)