Understand and use essential tools Flashcards Preview

Rhcsa > Understand and use essential tools > Flashcards

Flashcards in Understand and use essential tools Deck (51)
Loading flashcards...
1

Virtual Console or tty

Ctrl + alt + F1 through F6. Ctlr + alt+ F7 will bring back the GUI

2

cat example

cat << EOF > file1
> this is the content
> of file 1
> EOF

3

cat example 2

cat > file1
this is the content
of file1
^d
^d(ctrl+d stop entry)

4

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 root
grep 'root$' /etc/passwd end with root

5

generate ssh key

use the ssh-keygen command

6

create a tarball example

tar -cvf data.tar dataDir

7

gzip tar file/directory

gzip data.tar creates data.tar.gz

8

bzip tar file/directory

bzip data.tar creates data.tar.bz2

9

tar with gzip file/directory

tar -czvf data.tar.gz dataDir
tar -czvf data.tgz dataDir

10

tar with bzip2 file/directory

tar -cjvf data.tar.bz2 dataDir

11

extract tar.gz

tar -xzvf data.tar.gz

12

extract tar.bz2

tar -xjvf data.tar.bz2

13

Main Tar command options

c(create an archive), x(extract an archive), t(test or list the contents of an archive)

14

Other tar command options

v(verbosity), f(filename), z(for gzip), j(for bzip2)

15

bzip to uncompress files

bunzip abc.tar.bz2

16

gzip to uncompress files

gunzip2 etc.tgz

17

Star command

More appropriate for archiving files in a SELinux System. It's not installed by default:
# yum install star

18

Star command to archive a file

star -xattr -H=exustar -c -f=home.star /home

19

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}

20

Star extract file/directory(s) example

star -xv f=/tmp/archive2.star

21

star list files in an archive file

star -tv f=/tmp/archive2.star

22

Text editors

Vi(Preferred)
gedit(GUI)
nano(text editor)

23

Create a hard link

ln filetolink desktop/file

24

Create a symlink

ln -s filetolink desktop/filelink

25

To view inode #

ls -li file

26

Hard link

a pointer to a file's inode

27

soft link (symlink)

a pointer to a file

28

Linux ugo/rwx permissions

read (r)
write(w)
execute(x)

29

Octal value for permission bit

read = 4
write = 2
execute = 1
No permission(or dash "-") = 0

30

Umask command

The default permission in RHEL comes from the umask or user file creation mode mask value. run the umask command to see your default umask value:
# umask