CLI Flashcards

1
Q

CLI stands for ?

A

Command Line Interface.

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

” cat “ is used for ?

A

Type out or combine files.

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

” head “ is used for ?

A

Show the first few lines of a file.

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

” tail “ is used for ?

A

Show the last few lines of a file.

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

” man “ is used for ?

A

View the documentation.

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

The command is ?

A

The name of the program you are executing.

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

” sudo “ is used for ?

A

Provide user with administrative privileges.

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

Virtual Terminal is ?

A

Console sessions that use the entire display and keyboard outside of a graphical environment.

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

Virtual Terminal is helpful when ?

A

You run into problem with the graphical desktop. You can switch to VT and troubleshoot.

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

” shutdown -r “ is used for ?

A

Reboot the system.

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

To reboot the system, use command ?

A

shutdown -r

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

To cancel rebooting the system, use command ?

A

shutdown -c

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

The schedule shutting down the system ?

A

shutdown -h HH:mm “Message”

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

To locate program, use ?

A

” which “ or “ whereis “

i.e “which diff”, “whereis diff”

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

Display the current working directory ?

A

pwd

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

Change your current home directory ?

A

cd

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

Change to parent directory ?

A

cd ..

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

Change to previous directory ?

A

cd -

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

An absolute pathname is ?

A

Start with the root directory and follows the tree.

Always starts with /.

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

A relative pathname is ?

A

Start from the present working directory.

Never starts with /.

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

Displays a tree view of the filesystem ?

A

tree or tree -d

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

List all files, including hidden files and directories ?

A

ls -a

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

Create hard link from two files ?

A

ln file1 file2 (with file1 already exists)

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

Create soft link from two files ?

A

ln -s file1 file3 (with file1 already exists)

25
Q

View a file that is not very long, does not provide any roll-back?

A

cat

26
Q

Look at a file backward, starting from the last line ?

A

tac

27
Q

A paging program, used to view larger file ?

A

less

28
Q

Search for pattern in the forward direction with “ less “ program ?

A

less /{pattern}

29
Q

Search for pattern in the backward direction with “ less “ program ?

A

less ?{pattern}

30
Q

Print the last 10 lines of a file by default ?

A

tail

31
Q

Configure to print the last 15 lines of a file ?

A

tail -n 15

32
Q

Print the first 10 lines of a file by default ?

A

head

33
Q

Create an empty file ?

A

touch fileName

34
Q

Make a new directory ?

A

mkdir dirName

35
Q

Remove an empty directory ?

A

rmdir dirName

36
Q

Remove a file or move that file to another location ?

A

mv fileName

37
Q

Remove a file ?

A

rm fileName

38
Q

Remove a file interactively ?

A

rm -i fileName

39
Q

Remove a file forcefully ?

A

rm -f fileName

40
Q

Remove a directory forcefully ?

A

rm -rf dirName

41
Q

When commands are executed, by defaults how many file streams are there ?

A

3: stdin, stdout, stderr

42
Q

To set input to a file, which sign to use ?

A

<

$ do_something < input-file

43
Q

To set output to a file, which sign to use ?

A

>

$ do_something > output-file

44
Q

To redirect stderr to a separate file ?

A

Use stderr’s file descriptor number (2), the greater-than sign (>), followed by the name of the file you want to hold everything the running command writes to stderr:
($ do_something 2> error-file)

45
Q

To pipe the output of one command or program into another as its input ?

A

|

$ command 1 | command 2 | command 3

46
Q

To search for file ?

A

locate

$ locate zip | grep bin

47
Q

Wildcard: Matches any single character ?

A

?

ls ba?.out

48
Q

Wildcard: Matches any string of character ?

A

*

ls *.out.

49
Q

Wildcard: Matches any character in the set of characters, for example [adf] will match any occurrence of a, d, or f ?

A

[set]

50
Q

Wildcard: Matches any character not in the set of characters ?

A

[!set]

51
Q

What function / command that recurses down the filesystem tree from any particular directory (or set of directories) and locates files that match specified conditions ?

A

find

$ find /usr -name gcc

52
Q

Two most common Package Management System ?

A

Debian and RPM

53
Q

A Package Management System has … levels ?

A

2 (high level and low level)

54
Q

Example of high level package manager ?

A

dpkg (for Debian Family System)

rpm (for SUSE or Red Hat Family System)

55
Q

Example of low level package manager ?

A

apt-get (Debian Family System)
zypper (SUSE Family System)
yum (Red Hat Family System)

56
Q

What does a low level package manager do ?

A

+ Unpacking individual packages
+ Running scripts
+ Getting the software installed correctly

57
Q

What does a high level package manager do ?

A

+ Works with group of packages
+ Download packages from vendors
+ Figure out dependencies

58
Q

apt stands for ?

A

Advanced Packaging Tool

59
Q

Difference between a Console and a Terminal ?

A

The console is a terminal. A system has got one console and potentially multiple terminals. The console is typically the primary interface for managing a computer, eg while it is still booting up. A terminal is a session which can receive and send input and output for command-line programs.