RHCSA Ch3 Flashcards
find every file in root directory containing the word apache
find / -name *.txt | grep apache
Anchor the beginning and end
Only match beginning and end
^ = beginning $ = end
match one character
. = period
match 0 or more of the previous character
*
Match a range of characters
user[abc] - usera userb userc
user{a-z]
user[0-9]
What is a character set and give some examples
matches one character of a certain type {:digit:] - numbers [:upper:] - uppercase [:lower:] - lower case [:alpha:] - upper and lower case [:alnum:] - upper and lowercase, plus numbers
explian the following command
sudo tar –xattrs -cvpf etc.tar /etc
–xattrs - preserves extended attributes including Access Control list and SELinux Security contexts
-c - creates an archive
v - verbose
p - save ownership and permissions
f - file name
etc.tar - will be the achive file name
/etc - they file that will be archived
—– This will not compress file
sudo tar –gzip –xattrs -cvof etc.tar.gz /etc
creates archive file with gzip compression
Can do this with bzip2 (.bz) and xz (.xz)
list all file in tar archive (tarball)
tar -tf etc.tar
extract tarball
sudo tar –xattrs -xvpf etc.tar
-x - extract
zip and unzip a gzip file
gzip file.txt
gunzip file.gz
zip and unzip with bzip2
bzip2 file.txt
bunzip2 file.bz
zip and unzip with xz
xz file.txt
unxz file.xz
make multiple directories in one command
mkdir ~/{dir1,dir2,dir3}
mkdir ~/dir{1,2}
create a hard link
ln file.txt filelink.txt
lowercase L