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
look a statistic of a file. Include info like inode, links, etc…
stat file.txt
create a symbolic link
ln -s file.txt filesymlink.txt
In vim, how do you undo and redo
undo - command mode (esc) + u
redo - command mode CTRL +R
cut a letter, word, line
cl - letter
cw - word
cc - line
copy (yank) a letter, word, line
multiple letter, word, line
yl - letter
yw- word
yy - line
5 yy - yanks 5 lines
delete letter, word, line
dl - letter
dw- word
dd - line
delete keeps you in command mode
See man page categories
man man-pages
see the different man pages of a command
man -f crontab
info command
supports hyperlinks
info grep
hit enter to go to hyperlink - press ‘l’ to go back
What is rsyslog and where is it located?
persistent logs, logs are test files, can log remotely
/etc/rsyslog.conf
check OneNote for syntax
what is journald and where is it located
part of systemd, nonpersistant, logs are binary, logs into RAM, very fast
create a tarball with gzip compression (using the flag)
tar -czf /tmp/home.tar.gz /home
-z = gzip