Introduction to CLI Flashcards

1
Q

What characters tells that a prompt is for a normal user

A

$

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What characters tells that a prompt is for root user

A

#

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Execute command1 and command2 unconditionally one after the other

A

command1 ; command2

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Execute command2 after command1 only if later is successful

A

command1 && command2

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Execute command command2 after command1 if the later fails

A

command1 || command2

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Print the time

A

date +%R

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Print the date in the format 02/27/2022

A

date +%x

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Determine the type of the file /tmp/file-name.ext

A

file /tmp/file-name.ext

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Show the inode of the file newfile.txt

A

ls -li newfile.txt

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Create hard link of file newfile.txt

A

ln newfile.txt /tmp/newfile-hlink2.txt

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Limitations of hard links

A

1) No cross file systems
2) Not applicable to folders

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

How do you know the file system that a set of files are on

A

df

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Create symbolic link

A

ln -s /home/user/newfile-link2.txt /tmp/newfile-symlink.txt

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Create folders RHEL8, RHEL7, RHEL9 in one command without writing RHEL many times

A

mkdir ../RHEL{7,8,9}

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Print today day of the week

A

date +%A

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Search man pages by keyword in titles and descriptions

A

man -k passwd

17
Q

Interesting man page sections

A

Page 1: Normal user
Page 5: Config
Page 8: Admin

18
Q

Search man pages by keyword in full-text page, not only in the titles and descriptions

A

man -K passwd

19
Q

Open man page 1 for command gedit

A

man 1 gedit

20
Q

Redirect stdout and stderr to the same file

A

> file 2>&1

21
Q

login to machine remoteuser@remotehost with cert mylab.pem

A

ssh -i mylab.pem remoteuser@remotehost

22
Q

Shortcut to reuse the argument of the previous command

A

Esc + .

23
Q

Repeat the previous command

A

!!

24
Q

Important RHEL directories

A

/boot
/root
/home
/var
/usr (/usr/sbin, /usr/bin, /usr/local)
/etc
/run
/dev
/tmp

25
Q

Create files 1.jpg, 2.jpg, …9.jpg using brace expansion

A

touch {1,2,3,4,5,6,7,8,9}.jpg
touch {1..9}.jpg

26
Q

Different command line expansions

A

1) Brace expansion
2) Variable expansion
3) Tilde expansion
4) Pathname expansion
5) Command substitution

27
Q

Example of command substitution

A

echo Today is $(date +%A).

28
Q

create a formatted file of the passwd man page

A

man -t passwd > passwd.ps

29
Q

find which commands you can use for viewing and printing PostScript files

A

man -k postscript viewer

30
Q

open a ps file at page 3

A

evince -i 3 passwd.ps