5.4 Flashcards

1
Q

Files in UNIX are treated as ______ meaning they can contain any characters.

A

Byte streams

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

Linux provides a standard hierarchy for all UNIX-like OSs called the ___________. Under this directory structure, all directories and file fall under a root directory.

A

Linux File System Hierarchy

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

In Linux OSs the __ character indicates the root of the file system.

A

( / ) forward slash

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

The system administrator’s (root user) home directory.

A

/root

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

Directory that contains a subdirectory for each user who has logged on to the system.

A

/home

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

Enables each user to save individualized system preferences when logged on.

A

Profiles

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

Contains the system wide environment and startup programs in UNIX.

A

/etc/profile

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

A ___ character references paths that start with a user’s home directory.

A

( ~ ) tilde

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

Directory that contains static files of the boot loader; required to boot the system

A

/boot

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

Directory that contains essential command binaries (e.g., cp, mkdir, ls, less).

A

/bin

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

Directory that contains essential system binaries. Commands intended for use by privileged users (e.g., init, fdisk, ifconfig, lsmod).

A

/sbin

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

Second major hierarchy. User system resources such as user binaries and associated documentation, libraries, and header files.

A

/usr

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

Directory that contains shared libraries.

A

/lib

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

Directory that contains device files (block and character).

A

/dev

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

Directory that contains system administration and configuration files.

A

/etc

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

Directory that contains user home directories

A

/home

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

Directory that contains optional 3rd party software.

A

/opt

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

Directory that contains processes used by the system.

A

/proc

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

Directory that contains the root user’s home directory.

A

/root

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

Directory that contains temporary files used by the system.

A

/tmp

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

Directory that contains variable size data such as log files.

A

/var

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

Which command displays the current working directory in UNIX?

A

/pwd

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

Display text to standard output. (UNIX)

A

echo

Syntax: echo (standard output)

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

Creates a typescript of the terminal session (everything printed on the terminal). CTRL + d ends the script session. View results using less. (UNIX)

A

script

Syntax:
script (filename)

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

Prints system information. (UNIX)

A

uname

Options:
-a (Print all information.)

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

Lists directory contents in a tree-like form . (UNIX)

A

tree

Options:

  • C (Turn Colorization on)
  • F (Append a “/” for directories)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
27
Q

Lists contents of a directory. (UNIX)

A

ls

Options:

  • l (Long list - shows ownership, permission, and links)
  • i (Displays inode number in the first field)
  • s (Displays number of file system blocks used by file)
  • a (List all files including invisible files)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
28
Q

Creates an empty file. (UNIX)

A

touch

Options:
-t (Manipulates the file’s access date/time stamp)

Syntax:
touch (newemptyfile)
touch -t YYMMDDHHMM (filename)

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

Creates a link between files or directories. (UNIX)

A

ln

Options:
-s (Creates a symbolic link to another file (similar to a shortcut in Windows) )

Syntax:
ln -s (filename) (linkname)

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

Copies a file to a file or copies multiple files to a directory. (UNIX)

A

cp

Options:
-r (Recursively copy directories.)

Syntax:
cp (source-filename) (destination-filename)
cp -r (source-directory) (destination-directory)

31
Q

Moves or renames files and directories. (UNIX)

A

mv

Syntax:
mv (original-filename) (new-filename)

32
Q

Removes an empty directory. (UNIX)

A

rmdir

Syntax:
rmdir (emptydirectory)

33
Q

Removes a file (UNIX)

A

rm

Options:

  • r (Remove a directory and its contents recursively.)
  • f (Ignore nonexistent files, never prompt (force)

Syntax:
rm (filename)
rm -rf (directory_with_files)

34
Q

A program used to create and modify text files.

A

Text Editor

35
Q

Unix Text Editor

A

vi (vee-eye, short for visual)

36
Q

What are three appealing aspects of vi?

A
  • vi is normally supplied with all UNIX systems
  • vi requires very little memory
  • vi uses standard alphanumeric keys for commands
37
Q

Creates or edits a text file. (UNIX)

A

vi

Syntax:
vi (filename)

38
Q

What are the two modes of operation in the vi editor?

A

Command mode and Insert Mode

39
Q

Characters typed perform actions like moving cursor, cutting or copying text, or searching for a particular text string. vi opens in this mode.

A

Command Mode

40
Q

Actual text is typed or overwritten.

A

Insert Mode

41
Q

What are 7 common Insertion Commands?

A

i (Insert before cursor)
a (Append after cursor)
o (Insert below current line)
O (Insert above current line)
yy (Copy line into memory (yank-yank) )
p (Works with yy to (put) whatever line was copied, onto the existing or next line)
5p (Places five lines of what was copied, at cursor)

42
Q

What are 3 deletion command?

A

x (Delete current character)
r (Replace current character)
dd (Delete current line)

43
Q

What are 5 navigation commands?

A
h (Move cursor one place to the left)
l (Move cursor one place to the right)
j (Move cursor one place down)
k (Move cursor one place up)
/ (Searches within the document for a string)
44
Q

What are 3 additional commands?

A

:set nu (Displays line numbers for each line of text)
:(line number) Jumps to a given (line number)
:set nonu (Removes line numbers from each line of text)

45
Q

What are 4 exit commands?

A

:w (Writes (saves) latest changes to the file)
:q (Quits, leaving vi open in command mode)
:q! (Quits vi without saving changes)
:wq! (Saves file and any changes, and quits vi.)

46
Q

What are text viewer programs called?

A

Pagers

47
Q

Displays file contents one screen at a time. (UNIX)

A

more

Syntax:
more (filename)

48
Q

Displays the first 10 lines of a file. (UNIX)

A

head

Syntax:
head (filename)

49
Q

Displays the last 10 lines of a file. (UNIX)

A

tail

Syntax:
tail (filename)

50
Q

Displays file(s) contents to the screen and can concatenate (combine) files. (UNIX)

A

cat

Syntax:
cat (filename) (other_filename)
cat (filename1) (filename2) > (bothfiles)
cat (filename1)&raquo_space; (newfile)

51
Q

Locates files having certain specified characteristics. (UNIX)

A

find

Syntax:
find (directory_to_start_from) -(options) (patterns)

52
Q

Displays full path (location) of most (shell) commands. (UNIX)

A

which

Syntax:
which (command)

53
Q

Displays a snapshot status of active processes. (UNIX)

A

ps

Options:

  • e (Lists information about every process running)
  • l (Displays in a long format)
  • f (Generates a list in full mode format)

Syntax:
ps -elf

54
Q

A process running in the background is called what?

A

Daemon

55
Q

Stops a process from running using its PID. (UNIX)

A

kill

Options:
-9 (Used to kill a stubborn process that won’t die)

Syntax:
kill [option] (pid)

56
Q

Stops a process from running using its process name. (UNIX)

A

pkill

Options:

  • 9 (Used to kill a stubborn process that won’t die)
  • HUP (Used to immediately re-spawn a process to effect configuration changes. Stands for Hang-Up)

Syntax:
pkill [option] (process_name)

57
Q

Maintains a history file of all commands run by a particular user in that shell. (UNIX)

A

history

Syntax:
history

58
Q

Character to run a command from the history log. (UNIX)

A

( ! ) exclamation point

Syntax:
! (line number from history command output)

59
Q

Determines file type. (UNIX)

A

file

Syntax: file (filename)

60
Q

Prints the strings of printable characters in a file. (UNIX)

A

strings

Syntax:
strings (filename)

61
Q

Displays who the user is logged in as; at this moment (after switching user.) (UNIX)

A

whoami

Syntax:
whoami

62
Q

Displays user login information including login name, time, terminal, and more. (UNIX)

A

who

Syntax:
who

63
Q

Displays information about the user(s) logged in and what they are doing. (UNIX)

A

w

Syntax:
w

64
Q

Prints or sets the system date and/or time. (UNIX)

A

date

Options:
-s (date/time)

Syntax:
date

65
Q

Tape archive utility used to archive files to tape or disk. (UNIX)

A

tar

Options:
c (Create)
t (List table of contents of tar file)
x (Extract, must be in target directory to extract)
v (Verbose, list each file as tar reads/write)
f (Read/write to or from a file)
c (Change to directory)

Syntax:
tar [options] (destination-file) (source)

66
Q

Compresses files and saves them with a .gz file extension. (UNIX)

A

gzip

syntax:
gzip (filename)

67
Q

Decompresses a gzip compressed file. (UNIX)

A

gunzip

Syntax:
gunzip (filename)

68
Q

Compresses files and saves them with a .bz2 file extension. (UNIX)

A

bzip2

Syntax:
bzip2 (filename)

69
Q

Decompresses a bzip2 compressed file. (UNIX)

A

bunzip2

Syntax:
bunzip2 (filename)

70
Q

Schedules a job/process for a one-time execution. (UNIX)

A

at

Syntax:
at (scheduled time) ENTER
at> (Job/process to be performed at the scheduled time)
[CTRL + d] (Places the job into the queue.)

71
Q

List user’s pending jobs. (UNIX)

A

atq

72
Q

Deletes user’s jobs identified by job number. (UNIX)

A

atrm

73
Q

Schedules periodic jobs. (UNIX)

A

crontab

Options:

  • e (Edit the crontab)
  • l (List crontab entries)