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

tail

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
fgrep
The fgrep command is used to match literal characters, ignoring the special meaning of regular expression characters.
26
grep '^###'
Only files with beginning in ### will show
27
grep '###'
Searches for ### anywhere in a line
28
grep ###
Greedy, matches with anything with ### in it
29
grep '###$'
searches for ### at the end of a line
30
grep '.y'
Use the period character . to match any single character. For example, execute the following command to match any character followed by a 'y'
31
egrep ###|###
the | in egrep acts as an "or" statement | in egrep is used as an "or"
32
egrep 'no(b|n)'
() acts as a scope for |, searching for nob or non
33
grep [#-#]
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
grep [#-#]{#}
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
wc -l -w
word count, # of lines, # of words
36
vi :q!
quit without save changes in vi
37
vi :wq
save changes and quit
38
command that displays basic computer hardware
lscpu
39
command for how much ram/swap space
free -g / -m (gb mb respectively)
40
command for pci slot info
lspci
41
lspci -k
-k shows kernal driver info
41
find all usb connected devices
lsusb
42
show kernal drivers used to run linux
lsmod
43
fdisk
find disks
44
fdisk -l
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
Which commands will check hard disk MBR partitions?
fdisk sfdisk cfdisk
45
Which commands will check hard disk GPT partitions?
gdisk cgdisk sgdisk
46
ps
shows some running processes
47
pkill
kills by process
48
ps -e
shows all processes
49
ps -o
specify which columns to output
50
free
, the free command will show overall system memory usage:
51
ps aux
shows everything running in system
52
ps -f
shows extra info about things running in system
53
syslogd
The logging daemon on recent Linux distributions based on systemd
54
sbin
system binaries, under root, /
55
ping -c
-c is the number of times per ping, e.g. -c4 for 4 pings
56
dig
domain name finder
57
dig -x
use an IP address to look up a fqdn
58
netstat
network statistics, Displays active network connections: Shows which services are listening on which ports, and the status of open connections (e.g., LISTEN, ESTABLISHED). Shows routing tables: Provides the routing table used by the system to determine how to route packets to different network destinations. Displays interface statistics: Shows information about the network interfaces, including the number of packets sent and received.
59
netstat -t
tcp sockets for netstat
60
netstat -l
listening for sockets on netstat
61
netstat -n
the numbers or ip address numbers are listed
62
ss
ss command to view which connections are currently established between the local machine and remote machines, statistics about those connections, etc.
63
id
shows user id, gid
64
getent
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
output of /etc/passwd
name:password:UID:GID:Comment:directory:shell
66
who
Use the who command to get the current list of users on the system:
67
w
Use the w command to get a more detailed view of the users who are currently on your system:
68
id -g
show current users group
69
groupadd -r
-r is the reserved range, 1-999
70
groupmod -n
change name of a group
71
groupmod -g
change group GID
72
useradd -D
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
useradd -m
Make sure that their home directory will be created by specifying the -m option.
74
usermod -L
usermod -L student command could be used to "lock" the account.
75
usermod -U
The account could be unlocked with the usermod -U student command.
76
usermod -g / -G
option for the usermod command can be used to specify a user's group ID (either primary or secondary)?
77
UID 1-499
System users
78
ls -a
list hidden files
79
The setuid permission...
...allows a command to be run as the file owner.
80
The setgid permission...
...allows a command to be run as the group owner of the file. ...allows files created in a directory to be owned by the group that owns the directory.
81
useradd -d
specifies the home directory of the user
82
/tmp
temporary usage filesystem that is refreshed each reboot
83
man -k
keyword option for man pages
84
hide a file in linux
To hide a file in the Linux filesystem, simply rename it with a prefixed dot (.) to its filename. Therefore, mv password.txt .password.txt will cause the file password.txt to be renamed as a "dot" file and become hidden from the ls command.
85
tail -c
The -c option is used with tail to print only the last X bytes of data to the screen.
86
what does /sys do
The /sys virtual filesystem is used to interact with the kernel and system as a whole. It did not provide any method to interact with individual processes and was created to move some of the original functions from /proc to /sys to clean up the /proc structure.
87
isofs
The ISO File System (isofs) is a file system for optical disc media. Being published by the International Organization for Standardization (ISO), the file system is considered an international technical standard. Since the specification is available for anybody to purchase, implementations have been written for many operating systems, including Linux.
88
free
free storage left
89
Which GID is usually used to represent the root group on a Linux system?
0
90
umask
The umask command is used to change the default permission for files and directories at the time of the file's creation.
91
useradd -M
The -M option creates a user without a home directory using useradd. When the -m option is used, the user's home directory will be created using the system's default setup and template.
92