Exam 2 Flashcards

1
Q

Absolute pathname

A

Absolute pathname: refers to the complete path of a directory or file starting from the root directory (/). It
specifies the exact location of the directory or file in the filesystem hierarchy.
For example, /home/user/documents/file.txt is an absolute pathname. It starts from the root directory
(/) and specifies the complete path to the file file.txt

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

Relative pathname

A

specifies the location of a directory or file relative to the current working directory.

. (dot) represents the current directory.

.. (dot-dot) represents the parent directory.

~ (the tilde character) is a shorthand representation of the current user’s home directory.

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

!

A

not

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

$

A

Following string is a variable (should be all CAPS)

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

;

A

chains commands together

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

&

A

if one command errors. The next command will not run

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

`` backquote

A

substitutes whatever command is on the inside with its output

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

‘ ’ single quote

A

protects everything

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

“ ” double quotes

A

protects most things except \ = protects everything

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

*

A

represents unknown 0-255 char

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

?

A

represents only 1 char

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

[]

A

represents only 1 char and can contain numbers and a range of numbers and char and a range of char

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

[! ]

A

represents only 1 char and searches for anything not including the range/char/number indicated

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

apropos

A

search with a keyword
same as man -k command

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

cal

A

display current month’s calendar

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

option for calendar year

A

-y

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

cal -3

A

calendar for 3 months: previous, current, next

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

cd

A

change directory with an absolute or relative pathname

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

clear

A

clear the screen

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

date

A

display/change the system date and time

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

echo

A

display or echo output to the terminal screen

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

echo -e

A

utilize escape sequence

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

echo -n

A

newline

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

file

A

determine file type and display the detail information

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

How do you format the date time to show…
Today is dayName, monthName DAY YEAR

A

date +“Today is %A, %B %d %Y”

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

ls

A

list contents of a directory

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

ls -l

A

use long listing format

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

ls -a

A

shows all files including hidden files

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

ls -F

A

shows files with type indicator

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

ls -R

A

lists subdirectories recursively

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

ls -r

A

reverse order when sorting

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

ls -d

A

lists directory names instead of contents

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

ls -S

A

sort by file size

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

ls -i

A

prints the index number of each file

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

man

A

display online manual pages

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

man -k

A

search for keyword

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

mkdir

A

create the new directory

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

mkdir -p

A

create a hierarchy directory

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

mv

A

move files or rename files

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

mv -i

A

prompt if file move/rename will overwrite a file

41
Q

pwd

A

display the working directory with the
absolute pathname

42
Q

rm

A

remove files or “non-empty” directory

43
Q

rmdir

A

remove the “empty” directory

44
Q

touch

A

create a new file or multiple files as well
as change time stamp

45
Q

whatis

A

searches the what is database for
complete words

46
Q

who

A

display the number and Status of Users
Logged In?

47
Q

whoami

A

displays who you are.

48
Q

rm –r

A

remove the directories with files

49
Q

rm -f

50
Q

Redirect operator “<”

A

”<” input redirection.

redirect the standard input of a command to come from a file instead of the keyboard.

51
Q

Redirect operator “>”

A

redirect the standard output of a command to a file.

If the file does not exist, it will be created. If the file already exists, its contents will be overwritten.

52
Q

Redirect operator “»”

A

append the standard output of a command to a file.

If the file does not exist, it will be created. If the file already exists, the output will be added to the end of the file.

53
Q

Redirect operator “|”

A

”|” pipe symbol, is used to connect the output of one command to the input of another. It allows you to chain multiple commands together, forming a pipeline.

For example, you can use command1 | command2 to pass the output of “command1” as the input to “command2”.

54
Q

cat

A

concatenate and display the contents of files. It’s often used to read files sequentially, display their content, combine multiple files, create new files, and append contents to existing files.

Options -b -n -T

55
Q

cat file1

A

display the contents of the file1

56
Q

cat > newfile

A

create a new file and manual entry the contents for the ‘newfile’

57
Q

cat file1 > file2

A

copy the contents of file1 to create a file2

58
Q

cat file1 file2

A

combine file1 and file2 one after the other on the screen

59
Q

cat file1 file2 > file3

A

combine file1 and file2 one after the other and save the result to the file3 instead of displaying on the screen

60
Q

cat file1 >> file2

A

append contents of file1 to file2

61
Q

cmp

A

compare two files byte by byte. It’s often used to check if two files are identical or to find differences between them

cmp [option] file1 file2

62
Q

comm

A

compare two sorted files line by line. Outputs three columns.
1. lines unique to file1 (suppress with -1)
2. lines unique to file2 (suppress with -2)
3. files common to both (suppress with -3)

comm [options] file1 file2;

63
Q

cp

A

copy Files or directories
-i
-r or –R recursive
-f

64
Q

cut

A

extract sections from a file or input. Useful for selecting columns from text files like CSV files

cut -f 2 -d ':' file1 > file2
-f: Specifies the field(s) to extract ( -f1,3
extracts fields 1 and 3).
-d: Specifies the delimiter to use (default is the tab
character).
-c: Extracts characters by position (e.g., -c1-5
extracts characters 1 to 5 of each line).

65
Q

diff

A

compare the contents of two files line by line. Showing the differences.

66
Q

find

A

search for files and directories within a specified path. locates files based on various criteria such as filename, size, permissions, modification time, and more.

find <path> <options>

67
Q

grep

A

search for specific strings within files

68
Q

head

A

display the beginning or the first few lines of
a file. By default, it prints the first 10 lines of each
specified file to the standard output.

69
Q

head -n

A

display the beginning specified lines of a file

70
Q

join

A

joining lines of two files on a common field

71
Q

less

A

use to page through files; similar to more

72
Q

ln

A

create links between files
links are references or pointers to the original file
hard links and symbolic link

73
Q

ln -s

A

Creates a symbolic (soft) link

74
Q

ln -f

A

Forces the creation of the link by overwriting an
existing link with the same name.

75
Q

ln -v

A

show what links are being created

76
Q

ln -i

A

Prompts before overwriting an existing link.

77
Q

more

A

view files a screen at a time

78
Q

mv -f

79
Q

od

A

display the contents of files in
various formats, such as octal or
hexadecimal.

80
Q

paste

A

merge lines horizontally (side by side) of files, separated by a specified delimiter (by default, a tab).

paste [options][file ...].

81
Q

pr

A

format text files for printing.

Headers, divide text into columns, set custom margins, add page numbers, and adjust the layout to make printed output more readable.

82
Q

pr -n

A

Sets the number of columns (e.g., -2 for two
columns).

83
Q

pr -d

A

Double-spaces the output.

84
Q

pr -l N

A

-l N: Specifies the number of lines per page
(default is 66).

85
Q

pr -w N

A

Sets the width of the output in characters
(default is 72).

86
Q

rm -i

A

prompt before removal

87
Q

sed (stream editor)

A

text transformations on an input stream. Used for search, replace, substitute text.

88
Q

sort

A

sorts the text file by line

89
Q

strings

A

extract printable strings from binary files

90
Q

tac

A

the reverse of “cat” command. It is used to concatenate and display the contents of files in reverse order, line by line

91
Q

tail

A

display the last few lines of a file.
By default, it prints the last 10 lines of
each specified file to the standard output.

92
Q

tail -n

A

display the last specified lines in each specified file

93
Q

tee

A

reads input and writes output to screen and/or file

command | tee [options] [file …].

view and save the output
of a command.

94
Q

tr

A

translate or delete characters from standard input.

character substitution, deletion, case conversion.

95
Q

tr -d

A

d: Deletes characters specified in set1.

96
Q

tr -s

A

Squeezes multiple occurrences of a character in
set1 into a single occurrence in the output.

97
Q

uniq

A

remove duplicate lines

98
Q

wc

A

word, line and character counts

-lcw

99
Q

pr -h

A

Sets a custom header text