Linux essentials Flashcards

1
Q

tar -tvf

A

t = list v = verbose, f=filename

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

tar -z

A

compressed file with gzip

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

tar -c

A

create a tar file

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

ls -l

A

list files long (extra info

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

ls -h

A

list files, human readable

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

tar -xvf

A

extract files, verbose, file name

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

tar -r

A

add to existing archive

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

cp

A

copy

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

gzip

A

zips file, replaces old one

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

gzip -r

A

-r is recursive (subdirectories)

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

tar -j

A

compresses with bzip2

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

tar -t

A

list contents of the archive

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

tar -z

A

compresses with zip

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

stderr

A

Standard error (stderr) occurs when an error appears during the execution of a command; it has a file descriptor of 2. Error messages are also sent to the terminal window by default.

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

stdin

A

Standard input, stdin, usually is provided by you to a command by typing on the keyboard; it has a file descriptor of 0. However, by redirecting standard input, files can also be used as stdin.

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

stdout

A

stdout. The file descriptor number for this channel is 1.

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

tr

A

the tr command translates characters, but it only accepts data from stdin, never from a file name given as an argument. This is great when you want to do something like capitalize data that is inputted from the keyboard

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

more

A

pipeable/redirect command to do more of a long command

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

cut

A

The cut command is useful for extracting fields from files that are either delimited by a character, like the colon : in /etc/passwd, or that have a fixed width

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

head

A

top 10 lines of a file/dir

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

tails

A

last 10 lines of a file/dir

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

head -2

A

first two lines of that dir

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

head -n -#

A

head command is to use the option -n -#, where # is the number of lines counted from the bottom of the output to exclude. Notice the minus symbol - in front of the #

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

grep -e

A

The -E option to the grep command can be used to perform searches with extended regular expressions, essentially more powerful regular expressions. Another way to use extended regular expressions is to use the egrep command.

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

fgrep

A

The fgrep command is used to match literal characters, ignoring the special meaning of regular expression characters.

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

grep ‘^###’

A

Only files with beginning in ### will show

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

grep ‘###’

A

Searches for ### anywhere in a line

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

grep ###

A

Greedy, matches with anything with ### in it

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

grep ‘###$’

A

searches for ### at the end of a line

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

grep ‘.y’

A

Use the period character . to match any single character. For example, execute the following command to match any character followed by a ‘y’

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

egrep ###|###

A

the | in egrep acts as an “or” statement

in egrep is used as an “or”

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

egrep ‘no(b|n)’

A

() acts as a scope for |, searching for nob or non

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

grep [#-#]

A

The [ ] characters can also be used to match a single character. However, unlike the period character . the [ ] characters are used to specify exactly what character you want to match. For example, if you want to match a numeric character, you can specify [0-9]

34
Q

grep [#-#]{#}

A

You can use { } characters with a number to express that you want to repeat a pattern a specific number of times; for example: {3}.

35
Q

wc -l -w

A

word count, # of lines, # of words

36
Q

vi :q!

A

quit without save changes in vi

37
Q

vi :wq

A

save changes and quit

38
Q

command that displays basic computer hardware

A

lscpu

39
Q

command for how much ram/swap space

A

free -g / -m (gb mb respectively)

40
Q

command for pci slot info

A

lspci

41
Q

lspci -k

A

-k shows kernal driver info

41
Q

find all usb connected devices

A

lsusb

42
Q

show kernal drivers used to run linux

A

lsmod

43
Q

fdisk

A

find disks

44
Q

fdisk -l

A

When the -l option is used with fdisk, then the command will non-interactively list block devices, which includes disks (hard drives) and logical volumes.

45
Q

Which commands will check hard disk MBR partitions?

A

fdisk
sfdisk
cfdisk

45
Q

Which commands will check hard disk GPT partitions?

A

gdisk
cgdisk
sgdisk

46
Q

ps

A

shows some running processes

47
Q

pkill

A

kills by process

48
Q

ps -e

A

shows all processes

49
Q

ps -o

A

specify which columns to output

50
Q

free

A

, the free command will show overall system memory usage:

51
Q

ps aux

A

shows everything running in system

52
Q

ps -f

A

shows extra info about things running in system

53
Q

syslogd

A

The logging daemon on recent Linux distributions based on systemd

54
Q

sbin

A

system binaries, root

55
Q

ping -c

A

-c is the number of times per ping, e.g. -c4 for 4 pings

56
Q

dig

A

domain name finder

57
Q

dig -x

A

use an IP address to look up a fqdn

58
Q

netstat

A

network statistics

59
Q

netstat -t

A

tcp sockets for netstat

60
Q

netstat -l

A

listening for sockets on netstat

61
Q

netstat -n

A

the numbers or ip address numbers are listed

62
Q

ss

A

ss command to view which connections are currently established between the local machine and remote machines, statistics about those connections, etc.

63
Q

id

A

shows user id

64
Q

getent

A

The getent command has the advantage over the grep command as it is also able to access user accounts that are not defined locally. (servers)

65
Q

output of /etc/passwd

A

name:password:UID:GID:Comment:directory:shell

66
Q

who

A

Use the who command to get the current list of users on the system:

67
Q

w

A

Use the w command to get a more detailed view of the users who are currently on your system:

68
Q

id -g

A

show current users group

69
Q

groupadd -r

A

-r is the reserved range, 1-999

70
Q

groupmod -n

A

change name of a group

71
Q

groupmod -g

A

change group GID

72
Q

useradd -D

A

The -D option to the useradd command will allow you to view or change some of the default values used by the useradd command.

73
Q

useradd -m

A

Make sure that their home directory will be created by specifying the -m option.

74
Q

usermod -L

A

usermod -L student command could be used to “lock” the account.

75
Q

usermod -U

A

The account could be unlocked with the usermod -U student command.

76
Q

usermod -g / -G

A

option for the usermod command can be used to specify a user’s group ID (either primary or secondary)?

77
Q

UID 1-499

A

System users

78
Q

ls -a

A

list hidden files

79
Q
A
80
Q
A