Linux mod 5 Flashcards

1
Q

A program that provides text only interface for Linux and other UNIX like OSs.

Presents each user with a prompt, executes user commands and supports a custom environment for each user.

A

Shell

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

What does the # symbol indicate in

[root@Linux ~]#

A

Root user

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

What does the $ or % indicate

[bob@localhost ~]$
A

Non-root user

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

What are the different shells available?

A

Bourne Shell (sh)
Tenex C Shell(tcsh)
C Shell (csh)
Bourne-Again Shell (bash)

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

Display on-line manual pages about command.

A

man

Syntax: man

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

Clears the current screen

A

clear

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

Print working directory, displays the current working directory.

A

pwd

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

Displays the UNIX OS variant.

A

uname

uname -a Prints all information

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

Prints or sets the system date and/or time.

A

date

date -s
Sets date to date and time provided.

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

Lists directory contents in a tree-like format.

A

tree

tree -c Turn colorization on
tree -f Append a “/“ for directories

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

Exit the current shell

A

exit

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

Lists contents of a directory

A

ls
ls -l Long-list - shows ownership, permission, and links.
ls -i Inode number in the first field
ls -s number of file system blocks
ls -a List all files including invisible files

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

What are text files are viewed using text viewer utilities?

Don’t change file contents but allow forward and backward navigation as well as search.

A

Pagers

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

Displays text files one screen at a time.

A
less
Options: -b Backwards movement, one page at a time
/ Initiates a search for a string (word)
q Exits from less
SPACE BAR Advances one screen at a time
ENTER Key Advances one line at a time
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Works like the less command but with fewer options.

A

more

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

Automatically prints the first 10 lines of a file to standard output.

A

head

Syntax: head

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

Command automatically displays the last 10 lines

A

tail

Syntax: tail

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

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

A

cat

Syntax: cat
cat >

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

Change directory

A

cd
Syntax: cd //
cd

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

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
21
Q

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
22
Q

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
23
Q

Second major hierarchy. User system resources, i.e., 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
24
Q

Shared libraries.

A

/lib

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

Device files (block and character).

A

/dev

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

System administration and configuration files.

A

/etc

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

User home directories.

A

/home

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

Optional third-party software.

A

/opt

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

Processes used by system.

A

/proc

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

Root user’s home directory.

A

/root

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

Temporaru files used by the system

A

/tmp

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

Variable size data like that found in log files

A

/var

33
Q

In UNIX, the

current working directory is displayed using the ___ (print working directory) command.

A

pwd

34
Q

The _______ is based on the present working directory.

A

relative path

35
Q

An _______ in UNIX begins at the root ( / ) directory.

A

absolute path

36
Q

Displays text to standard output.

A

echo
Syntax:
echo

37
Q

The path statement is modified using the ____ command

A

PATH
Example:[root@localhost etc]# PATH=$PATH:/usr/demo
[root@localhost ~]# echo $PATH

38
Q

All UNIX variances come with a visual editor pre-installed.

A

vi
normally supplied with all UNIX systems

requires very little memory

uses standard alphanumeric keys for commands

Syntax vi

39
Q

Which modes does vi have?

A

There are only two modes of operation in the vi editor:
Command Mode Characters typed perform actions like moving the cursor, cutting or
copying text, or searching for a particular text string. vi opens in
command mode.
Insert Mode Actual text is typed or overwritten.

40
Q

Insertion commands for vi:

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 place copied line onto the existing or next line
5p Places five lines of what was copied, at cursor

41
Q

Deletion commands

A

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

42
Q

Navigation commands

A

h Move cursor one place to the left
l (lower case 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

43
Q

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.

44
Q

Creates an empty file and is also used to modify a files timestamp.

A

touch
Options: -a Manipulates the file’s access date/time stamp
Syntax: touch
touch -a YYMMDDHHMM

45
Q

Creates one or more directories

A

mkdir
Options: -p Creates a directory where no parent exists (nested)
Syntax: mkdir
mkdir -p //

46
Q

Copies files and directories

A

Options: -r Recursively copy directories.
Syntax: cp
cp –r

47
Q

Moves or renames files and directories.

A

mv

Syntax: mv

48
Q

Creates a link between files and directories.

A

ln
Options: -s Creates a symbolic link to another file.
Syntax: ln -s

49
Q

Removes a file or a directory with contents if using the -r option.

A

rm
Options: -r Remove a directory and its contents recursively
-f Ignore nonexistent files, never prompt (force).
Syntax: rm
rm -rf

50
Q

Searches a file or files for lines that contain strings of a certain pattern.

A

grep

Syntax: grep

51
Q

Locates files having certain specified characteristics.

A

find

Syntax: find -

52
Q

Displays full path (location) or most (shell) commands.

A

which

Syntax: which

53
Q

Determines file type

A

file

Syntax: file

54
Q

Displays a snapshot status of active processes. A process running in the
background is called a daemon.

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
55
Q

Stops a process from running using its PID

A

kill
Options: -9 Used to kill a stubborn process that won’t die
Syntax: kill [option]

56
Q

Stops a process from running using its process name.

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. After modifying a daemon’s
configuration file, use pkill -HUP to hang up and
restart the daemon with the new configuration.
Syntax: pkill [option]

57
Q

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

A

history

history is also used to run previous commands by using an exclamation point (!)
followed by the corresponding line number in the history output.
Syntax: !

58
Q

Prints the strings of printable characters in a file (not ASCII characters). Useful in determining contents of nono-text files (executables)

A

strings

strings

59
Q

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

A

script

script

60
Q

Used to switch from the current user account to another. It is often used to
switch to root user to perform tasks requiring elevated privileges.

A

su

su

61
Q

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

A

whoami

Syntax: whoami

62
Q

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

A

who

Syntax: who

63
Q

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

A

w

64
Q

_________is used on audio data because some

portions of the data can be thrown away without significant degradation of sound quality.

A

Lossy Compression

65
Q

______compression creates a file smaller than the original that can later be reconstructed,
maintaining all of its data and metadata.

A

Lossless

66
Q

Compresses files and appends a .gz file extension. The original file is replaces.

A

gzip

Syntax: gzip

67
Q

Decompresses a file that was compressed with gzip.

A

gunzip

Syntax: gunzip

68
Q

The tape archive
___ command is an archiving utility that has been around since the early days of UNIX and was
designed to archive data to a tape drive.

A

tar

69
Q

Tape archive utility used to archive files to tape or disk.

A

tar
Options: c Create an archive
t List table of contents of tar file
x Extract, must be in target directory to extract
z Compress the archived file using gzip (tarball)
v Verbose, list each file as tar reads/writes
f Read/write to or from a file
C Change to directory
Syntax: tar -[options]

70
Q

Schedules a job/process for a one-time execution.

A

at
Syntax: at ENTER
at>
[CTRL+d] Places the job into the queue and exits

71
Q

Lists user’s pending jobs.

A

atq

72
Q

Deletes user’s jobs identified by job number.

A

atrm

73
Q

Schedules periodic jobs. The cron daemon (crond) checks the /etc/crontab every
minute for any jobs that need to run. To create a cron job, the cron table
(crontab) is created or modified.

A

crontab
Options: -e Edit the crontab
-l List crontab entries

74
Q

Creates a new user or updates default new user information.

A

useradd
Options: -d Specifies the path of the user’s home directory;
Linux - users’ home directories are in /home
-m Makes a home directory if it doesn’t already exist
-n Assigns whatever group is in default
Syntax: useradd -d /home/ -m -n

75
Q

Deletes a user account

A

userdel
Options: -r (Recursively) Removes the home directory for
specified user
Syntax: userdel -r

76
Q

Enables a user to change their password (no user name) or for root to set and
modify password settings.

A

passwd

Syntax: passwd

77
Q

Contains the system wide environment and startup programs. When a
user logs on to a system for the first time and/or does not have a profile,
the settings contained in the systems file are used to create
the user’s profile.

A

/etc/profile

78
Q
A tilde (~) references paths that start with a user’s home directory.
Depending upon the shell and type of login used, users customize their
environment by modifying either ~/.bash_profile,~/.bashrc, or ~/.profile.
A

~/.bashrc