Note: Please don't run rm -rf / it will delete all the files on your system and probably anything else that's mounted from your system.
# find files with the extension .cof in the /etc/ directory
# use -prune to ignore a subtree
find /etc -name '*.conf'
# Find any directories with world write permission
find . -type d -perm 777 -print
# Find a folder called test
find /root/dir/to/check -type d -name 'test'
# search everything in the current dir and below, recursive and show file names
grep -RH 'test' *
Unzip me baby!
Why use tar.gz?
very good compression
not too much CPU comsuption while compressing data
it's awesome, see the first two points
This example assumes:
archive_name.tar.gz is the name of your archive file
directory_to_compress is the name of the directory you'd like to compress
/tmp/extract_here/ the path of a specific directory
# compress a directory
tar -zcvf archive_name.tar.gz directory_to_compress
# decompress an archive to current directory
tar -zxvf archive_name.tar.gz
# decompress an archive to a specific directory
tar -zxvf archive_name.tar.gz -C /tmp/extract_here/
And some more info for those interested:
-c create a new archive
-z filter the archive through gzip
-f use archive file or device F (default "-", meaning stdin/stdout)
-v verbosely list files processed
-x extract files from an archive
Note: Probably won't work well with symbolic links, better to use real folders.
No comments:
Post a Comment