Basic unix commands Flashcards
to crack the interviews
create a tar archive file tecmint-14-09-12.tar for a directory /home/tecmint in current working directory
tar -cvf tecmint-14-09-12.tar /home/tecmint
-cvf options specified? no? then rate 2
create a compressed MyImages-14-09-12.tar.gz file for the directory /home/MyImages
tar -cvzf MyImages-14-09-12.tar.gz /home/MyImages
right extension of tar file, no-rate 3
create a Phpfiles-org.tar.bz2 file for a directory /home/php
tar -cvfj Phpfiles-org.tar.bz2 /home/php
options specified? no? then rate 2
right extension of tar file, no-rate 3
untar the file public_html-14-09-12.tar in present working directory
tar -xvf public_html-14-09-12.tar
options specified? no? then rate 2
if said untar instead of tar -x, rate 1
Uncompress tar.gz archive file in different working directory /etc/psswd -the absolute path
tar -xvf public_html-14-09-12.tar.gz -C /etc/psswd
options specified? no? then rate 2
if said untar instead of tar -x, rate 1
right extension of tar file, no-rate 3
Uncompress highly compressed tar.bz2 file
tar -xvf public_html-14-09-12.tar.bz2
options specified? no? then rate 2
if said untar instead of tar -x, rate 1
right extension of tar file, no-rate 3
no j in the options during uncompress-note this
list the content of uploadprogress.tar file.
tar -tvf uploadprogress.tar
options specified? no? then rate 2
list the content of tar.gz file
tar -tvf uploadprogress.tar.gz
options specified? no? then rate 2
right extension of tar file, no-rate 3
list the content of tar.bz2 file
tar -tvf uploadprogress.tar.bz2
options specified? no? then rate 2
right extension of tar file, no-rate 3
extract a single file called cleanfiles.sh from cleanfiles.sh.tar
tar -xvf cleanfiles.sh.tar cleanfiles.sh
command arguments in same order or not? no -rate 3
options specified? no? then rate 2
extract a single file tecmintbackup.xml from tecmintbackup.tar.gz archive file
tar -zxvf tecmintbackup.tar.gz tecmintbackup.xml
command arguments(not options) in same order or not? no -rate 3 options specified? no? then rate 2
extract a single file called index.php from the file Phpfiles-org.tar.bz2
tar -jxvf Phpfiles-org.tar.bz2 index.php
command arguments(not options) in same order or not? no -rate 3
options specified? no? then rate 2
j and respective z options are required here
extract or untar multiple files from the tar, tar.gz and tar.bz2 archive file
tar -jxvf Phpfiles-org.tar.bz2 “file1.xml”,” file2.xml”
tar -zxvf tecmintbackup.tar.gz “file1.xml”,” file2.xml”
tar -xvf cleanfiles.sh.tar “index.php” , “k2.php”
options specified? no? then rate 2 command arguments(not options) in same order or not? no -rate 2
extract a group of all files whose pattern begins with .php from a tar, tar.gz and tar.bz2 archive file
tar -jxvf Phpfiles-org.tar.bz2 –wildcards ‘.php’
tar -zxvf tecmintbackup.tar.gz –wildcards ‘.php’
tar -xvf cleanfiles.sh.tar –wildcards ‘*.php’
options specified? no? then rate 2
command arguments(not options) in same order or not? no -rate 2
quotations and regex not correct, rate 3
add file xyz.txt and directory php to existing tecmint-14-09-12.tar archive file
tar -rvf tecmint-14-09-12.tar xyz.txt
tar -rvf tecmint-14-09-12.tar php
options specified? no? then rate 2
command arguments(not options) in same order or not? no -rate 2
quotations and regex not correct, rate 3
didnt identify which option for append, rate 1
add files or directories to an existing compressed tar.gz and tar.bz2 archive file
tar -rvf tecmint-14-09-12.tar.gz xyz.txt
tar -rvf tecmint-14-09-12.tar.bz2 php
options specified? no? then rate 2
command arguments(not options) in same order or not? no -rate 2
quotations and regex not correct, rate 3
didnt identify which option for append, rate 1
check the size of any tar, tar.gz and tar.bz2 archive file
tar -czvf tecmint-14-09-12.tar.gz xyz.txt | wc -c
tar -cjvf tecmint-14-09-12.tar.bz2 php | wc -c
options specified? no? then rate 2
command arguments(not options) in same order or not? no -rate 2
quotations and regex not correct, rate 3
didnt identify which option for size check , rate 1
see the actual content of that tar file
tar -tvf actualcontent.tar
options specified? no? then rate 2
right extension of tar file, no-rate 3
didn’t understand the question , rate 1
didn’t remember the right option, rate 1
create tar file in Unix with just specified contents
tar -cvf equitytrading.tar equity currency
command arguments(not options) in same order or not? no -rate 2 didn't understand the question , rate 1
view contents of gzip tar file
tar -ztvf trading.tgz
options specified? no? then rate 2
know the size of tar file before creating it
tar -cf - * | wc -c
didn’t understand the question , rate 1
options specified? no? then rate 2
How To Uncompress A Tar.Gz In Another Directory
tar xzf archive.tar.gz -C /destination
didn’t understand the question , rate 1
options specified? no? then rate 2
Using tar -xzvf filename.tar.gz doesn’t extract the file. it is gives this error:
gzip: stdin: not in gzip format
tar: Child returned status 1
tar: Error exit delayed from previous errors
If file filename.tar.gz gives this message: POSIX tar archive, the archive is a tar, not a GZip archive.
Unpack a tar without the z, it is for gzipped (compressed), only:
mv filename.tar.gz filename.tar # optional
tar xvf filename.tar
didn’t understand the question , rate 1
options specified? no? then rate 2
don’t remember the solution, rate 3
How to check if a Unix .tar.gz file is a valid file without uncompressing?
What about just getting a listing of the tarball and throw away the output, rather than decompressing the file?
tar -tzf my_tar.tar.gz >/dev/null
This test in no way implies integrity of the data. Because it was designed as a tape archival utility most implementations of tar will allow multiple copies of the same file!