Useful Unix Commands

To backup everything in the current directory, exclude anything ending with jpg:

tar cvf mybackup.tar --exclude "*.jpg" .

To exclude more than one type, just add another –exclude statement:

tar cvf mybackup.tar --exclude ".jpg" --exclude ".gif" .

Search current directory and sub directories for mp3 files:

find . -name *mp3

Need to Learn: how to get the total size of the files returned by the above search command

AIX

Those were on RHEL, not aix Рthey will work for a lamp instance.  With AIX we have to consult the man tar page.

This should work:
find . ! -name “*.mp3” > inputfilelist
tar -cvf mybackup.tar -L inputfilelist

This should also work (in the opposite direction):
find . -name “*.mp3” > excludefilelist
tar -cvf mybackup.tar -X excludefilelist .

In either case, you can use this to see if there are any mp3 files in the archive:
tar -tvf mybackup.tar | grep mp3

Related Posts:

  • No Related Posts
This entry was posted in Tech Opinion, Tech Tips, Web Development and tagged . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *