understand and use essential tools Flashcards
Understand and use essential tools
Virtual Console or tty
Ctrl + alt + F1 through F6.
Ctlr + alt+ F7 will bring back the GUI
cat example
cat «_space;EOF > file1
> this is the content
of file 1
EOF
cat example 2
#cat > file1 this is the content of file1 ^d^d(ctrl+d stop entry)
grep examples
#grep --color 'root' /etc/passwd #grep -i 'root' /etc/passwd matches case insensitive #grep -v 'root' /etc/passwd matches everything but root #grep -n [Aa] text.txt matches upper and lower case #grep '^root' /etc/passwd starts with rootgrep 'root$' /etc/passwd end with root
generate ssh key
use the ssh-keygen command
create a tarball example
tar -cvf data.tar dataDir
gzip tar file/directory
gzip data.tar creates data.tar.gz
bzip tar file/directory
bzip data.tar creates data.tar.bz2
tar with gzip file/directory
tar -czvf data.tar.gz dataDirtar -czvf data.tgz dataDir
tar with bzip2 file/directory
tar -cjvf data.tar.bz2 dataDir
extract tar.gz
tar -xzvf data.tar.gz
extract tar.bz2
tar -xjvf data.tar.bz2
Main Tar command options
c(create an archive), x(extract an archive), t(test or list the contents of an archive)
Other tar command options
v(verbosity), f(filename), z(for gzip), j(for bzip2)
bzip to uncompress files
bunzip abc.tar.bz2
gzip to uncompress files
gunzip2 etc.tgz
Star command
More appropriate for archiving files in a SELinux System. It's not installed by default: # yum install star
Star command to archive a file
star -xattr -H=exustar -c -f=home.star /home
star more example to compress a file/directory(ies)
star -cv f=archive2.star test-dir
star -xattr -H=exustar -c -f=files.star file{1,2,3}
Star extract file/directory(s) example
star -xv f=/tmp/archive2.star