4 File Management & 10 Network Settings Flashcards

1
Q

/bin

A

stores essential command-line utilities and binaries

e.x. ls

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

/boot

A

stores files to boot system

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

/dev

A

stores hardware and software device drivers

e.x. storages devices here

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

/etc

A

stores basic config files for system and services

e.x.
/etc/samba/smb.conf file stores Samba config data
-manage SSH access
-firewall rules
-software management settings

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

/home

A

stores users’ home dir and their personal files

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

/lib

A

stores shared program libraries required by the kernel, CLI utilities and binaries

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

/media

A

stores mount points for removable media like CD-ROMS and floppy disks

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

/mnt

A

mount point for temporarily mounting file systems

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

/opt

A

stores optional files of large software packages.
often packages create sub directories

e.x. /opt/nessus contains files for Nessus vulnerability scanning programs

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

/proc

A

virtual file system representing continuously updates kernel info in a user file

e.x. /proc/mounts

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

/sbin

A

Stores binaries used for boot process and by the root user

e.x. /sbin/ifconfig used to manage network interfaces

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

/sys

A

a VFS storing info about devices

e.x. /sys/block includes links to devices that are stored in various subdir under /sys/ devices/

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

/tmp

A

stores temporary files that may be lost on system shutdown

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

/usr

A

contains important subdir

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

/usr/bin

A

/usr/bin - .exe programs that can be used by all users

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

/usr/local

A

/usr/local - custom built applications stored here by default

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

/usr/lib

A

/usr/lib - objects libraries and internal binaries needed by .exe files

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

/usr/lib64

A

/usr/lib64 - same purpose as /usr/lib but meant for b4-bit systems

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

/usr/share

A

/usr/share - contains read-only architecture independent files. can be shared among different architectures of an OS

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

/var

A

stores variable files that are expected to change constantly

e.x. log files, printer spools, and some networking services

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

stat command

A

displays file metadata

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

file command

A

displays info on the file type and application compatibility

e.x.
.pdf version info
.jpeg image info

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

absolute path

A

defines dir to traverse, starting from root of file system “/”

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

relative path

A

defines path beginning from the users current location instead of “/”

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

index node (inode)

A

the object identifier that stores metadata of a file and is represented as an integer
Inode tables map the inode value to corresponding file/dir

e.x. perms, time-stamps, ownerships, block locations, etc.

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

ln –backup -f -s -i -v

A

link to a target file/dir
–backup backup existing destination files
-f Remove existing destination files
-s symbolic link
-i prompt to remove destination files
-v print name of file before linking

links can be made for file and dir, but cannot link a target dir to a destination dir, nor can the link exist between file systems (e.g. ext4 to ext3)

ln [options] {target name} {link name}

links are seen in ls -l and point to the target file its linked to.

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

difference between hard and symbolic links

A

hard links - are treated as a file and link to the same in as its target file, if the target file is deleted, the hard link still exists.

symbolic links - create their own inode # that link to the target file, if the target file is deleted, the link is broken; however, the link can be unbroken if the same file and extension the link targeted is recreated

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

”.” “..”

A

. - current dir
.. - previous dir

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

tree command -a -d -s -D

A

display file system in familial structure

-a all files including hidden
-d dir only
-s display file size
-D display last modification date

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

ls -a -l -d -R -s

A

list files:
-a all contents including hidden
-l in long format
-d dir only
-R contents of subdir
-s display file sizes

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

rm -f -i -R

A

-f never prompt confirmation
-i interactive mode prompting for confirmation (usually set as an alias)
-R recursively remove a non empty dir and its contents

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

difference with rm and rmdir

A

rmdir specifies dir and only removes the dir; the contents are then placed in the location its parent dir originally existed

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

head/tail -n

A

specify number of lines with a space and #

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

tee command

command [options] [arguments] | tee [options] {file names}

A

reads the input and both prints and sends (think of it as redirects) output to each specified file

-a appends

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

xargs command definition and process

command [options] [arguments] | xargs [options] {command}

A

used after pipe and executes a command for each argument in the previous command with a relation to the results and a space present

e.x. find /projects -type f -name “*.pdf” | xargs rm

finds files in projects with the .pdf extension and xargs runs rm for each file as its own instance

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

xargs options -I( uppercase i)
-L -p n -E -t -s

A

-I {replacement string}

Consider each line in the standard input as a single argument

-L {number of lines}

Read a specified number of lines from the standard input, and concatenate them into one long string

-p

Prompt the user before each command

-n {number of arguments}

Control the number of argument read at a time from scource input

-E {end of string}

Represent the end of the standard input

-t

Preview output before executing

-s {max size}

Set the maximum allowable size of an argument list to a specified number of characters

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

find format and options

A

find {where to search using path} {option} {search criteria}

options
-name
-type f/d
-perm
-user
-group

only searches the files system not the contents of a file
should print absolute path to file

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

locate command

A

searches like find but relies on index database and is quicker and uses files and dir along a path but requires up-to-date database

locate [options] {string}
option -i ignore case

39
Q

updatedb command

A

build and update database of files based on /etc/update.conf

40
Q

/etc/update.conf

/var/lib/mlocate/mlocate.db

A

.conf can be changed and set to exclude dir for indexing. (link?)

/var is where the db is located.

41
Q

which command

A

displays path of a specified command

42
Q

printf command

A

like echo but allows more control using “\n”

”" indicates format characters like newline

43
Q

tr command

A

translate a string replacing {character1} with {character2}

44
Q

wc command -c -m -l -w

A

word count command

-c byte count
-m character count
-l newline count
-w work count

45
Q

sort command -k{column #} -n - r -t{delimiter}

A

arrange lines in file:

-k{column #} specify field values from 1+
does -k1..3 work?
-n compare sort lines to numerical value
-r sort filed in descending value
-t{delimiter} separate on field from another

46
Q

cut command -c -d{delimiter} -f{files #} -s

A

extract specified lines of a file
-c specify the character # to start each cut
-d{delimiter} separate one field from another
-s suppress line if delimiter not found

47
Q

paste command

A

paste [option] {file names}

merges files where each line of a file represent a column or each line is pasted parallel to with respect to the same line of the other file

default delimiter separates fields with a tab
-d {delimiter}

48
Q

diff command -b -i -t -w -c -u

A

compares file1 to 2:
< before a line means file 2 is missing the line and could be removed to match
> before a line means file 1 is missing line found in file 2 and could be added to match

-b ignore spacing diff
-i ignore case diff
-t expand tab characters in output
-w ignore spacing diff
-c display diff with 3 lines of context
-u out in unified mode more streamlined

49
Q

awk command def and operations

awk [options] [‘patterns {actions}’] {file-names}

A

performs pattern matching on files.
The command is followed by a pattern and a action to be performed in single quotes.
If no pattern specified, action is performed on all input data input.
If no action is specified, the line with the pattern is printed.

50
Q

awk examples

A

query and retrieve all records beginning with “a” “b” or “c” :
awk ‘/[abc]/’ example.txt

’/{pattern}/’ matches address in sed that can match to every occurrence if specified

[] implies separately?

retrieve record whose 1st field begins “abc” :
awk “abc” example.txt

51
Q

sed command [options]: d, “-n,p”, s “s,g”

sed {‘option/address/ action’} {file-names}

A

stream editor cmd to modify text files

d- delete lines matching specified pattern or line
-format end /#d or alone in single quotes line=# or x,yd range
-n,p - print only lines containing pattern
- s - substitute first occurrence of string
-s formates as ‘s/pattern/substitute/‘
Adding a # at the end “/“ specifies after
the # of occurrences, substitute once in with #g its every time the occurrence is met
- s,g - globally substitute original string with replacement for each occurrence
-formates with ‘s/pattern/substitute/g’

-address specifies lines to act on or text matching given regular expression pattern
-optional
-action is name of input file l
-e.x. cut?

option/address/action enclosed in single quotes

Other formats
Add parenthesis after first letter of each word:
echo “Welcome To The Geek Stuff” | sed ‘s/(\b[A-Z])/(\1)/g’
Replace string on line number:
$sed ‘3 s/unix/linux/’ geekfile.txt
Print replace line twice: with /p flag
sed ‘s/unix/linux/p’ geekfile.txt

52
Q

IP [subcmds]: l , a , r, n

A

link (l)- display and modify network interfaces
address (a) - display and modify IP addresses
route (r) - display and alter routing table
neigh (n) - display and manipulate neighbor objects (ARP table)

must be done w/ sudo

53
Q

modifying IP addr

A

Ip addr {show} {add| del} {Address/cidr} dev {interface name}

ip -4/6 addr to show only ipv4/6

54
Q

modify network interfaces

A

Ip link {show} {set| add| del} dev {exit interface} {up|down}

55
Q

alter routing table

A

Ip route {list} {add| del} {network id/cidr} {via| dev} {IP addr|exit interface}

default route
ip route add default via {ip addr} dev {exit interface}

56
Q

route cmd

A

can also add a route with :
route {add| del} -net {net ID/CIDR} netmask {subnet mask} dev {interface}

57
Q

ifconfig ip addr assign

A

ifconfig [interface-name] [ip-address] netmask [subnet-mask]

secondary ip addr:
ifconfig [interface-name]:0 [ip-address] netmask [subnet-mask]

58
Q

ifconfig enable or disable interface

A

ifoncifg {interface} {up| down}

59
Q

if config change mac addr

A

ifconfig {interface} hw ether {mac-addr (“:” delimiter)}

60
Q

ifcfg command

A

ip and ifconfig alternate but lest robust

61
Q

iwconfig command nick, mode, freq, channel, retry

A

wireless NIC configs

nick {name} - set nickname for NIC

mode {mode}- set operating mode corresponding to topology

freq {#} - set Wi-Fi frequency

channel {#} - set Wi-Fi channel

retry {#} set max # MAC retransmission for NIC

62
Q

nmcli [subcmds]

A

most fundamental tool for NetworkManager interfaces

general status -view summary of network connectivity

connection show - view id info for each NIC

con {up| down} {dev ID} - {enable| disable} specified NIC

con edit {dev ID} - interactive mode to configure NIC

device status - display current status of NIC

63
Q

nmtui cmd

A

text based user interface to configure network options

64
Q

GNOME Network Manager applet

A

networkmanager GUI tool on GNOME desktop

65
Q

where are network config stored?

A

in many files and dir
found in /etc/sysconfig or /etc/network for many Debian derivatives

66
Q

what is /etc/sysconfig/network file

A

configures hostname, and gateway info, and if networking should enable at boot

67
Q

what is /etc/sysconfig/network-scripts dir

A

config files for NICS, bonds, bridges in the form of ifcfg-<NIC> as a per interface basis</NIC>

e.x.
static or dynamic IP
enables or disabled
etc.

previous tools better manage files than editing file directly

68
Q

ethtool cmd -S -i -t -s -f

A

manages NIC driver and network configs:

-S {interface} - show stats for NIC
-i {interface} - show driver info on NIC
t {interface} - execute self-test on NIC
-s {interface} {settings} {value} - change some NIC settings such as speed and duplex mode
-f {interface} - write (“flash”) a firmware image to NIC

69
Q

where is primary DHCP client config file

A

/etc/dhcp/dhclient.conf file

enabling configeration of DHCP client settings, including timeout values, dynamic DNS configs, etc.

file is called and managed by NetworkManager

70
Q

dhclient cmd

A

manages current config:

alone send broadcast DHCPDiscover

-r release current IP config

71
Q

how is DNS managed

A

in /etc/host file or via DNS server

72
Q

hostnamectl cmd

A

view system hostname

set hostname with hostnamectl set-hostname {hostname}

73
Q

what is /etc/host file

A

system file recording association of IP addr to hostnames in that order

e.x. connecting to experimental server no registered on network

74
Q

what is /etc/resolv.conf file?

A

file recording DNS server entries in newlines as server-hostnames and their IP addr in that order

maintain order for new self made entries

75
Q

what is /etc/nsswitch.conf file?

A

specifies the order to resolve hostnames and ips

format:
host: (tab) {1st} {2nd} {myhostname}

ex:
hosts: (tab) /etc/hosts dns myhostname

76
Q

ssh files

A

/etc/ssh/ssh_config : defining client settings usually not custumized

/etc/ssh/sshd_config “ contains many config options (mostly security oriented)
e.x.
Port 2222
block root authenticating over ssh:
PermitRootLogin no

key-based auth preventing passwd authentication:
PublicKeyAuthentication yes : set 1st then test
PasswordAuthentication no : 2nd

changes made must restart sshd

77
Q

what is ~/.ssh/config ?

A

configure user specific setting for the SSH connections and can include many

prevent remembering setting of multiple server connections

e.x.
HOST {hostname}
(tab) Hostname {FQDN}
(tab) User {uname}
(tab) port {port}

78
Q

what is ~/.ssh/authorized_keys ?

A

stores keys on the remote SSH servers the client connects to for key based authentication

file on the remote server not host

79
Q

what is ~/.ssh/known_hosts ?

A

file that stores public keys of remote systems client connected to. located local SSH client to protect from man-in-middle

80
Q

how to configure key based authentication?

A

on client machine:
Generate key pair
1. ssh-keygen

Transfer key to remote system
2. ssh-copy-id {username}@{ip-addr of remote host}

Test connection
3. ssh {username}@{ip-addr or remote host}

81
Q

SSH port forwarding

A

tunneling an application through SSH

e.x. VNC on port 5900

82
Q

SCP tool and cmd

A

copy data to or from remote server over SSH. uses TCP:22 by default

scp {file name} {username}@{ip-addr of remote host}:/home/dir

83
Q

sftp cmd

A

SSH FTP uses SSH tunnel

sftp {username}@{ip-addr of remote host}:{file}

84
Q

rsync cmd

A

over SSH or rsyncd daemon

copies files both ways but only the differences between the same file: synchronizing

synchronize from one location to another:
rsync -a /home/mydir/ {username}@{ip-addr or remote host}:/home/mydir/

85
Q

remote GUI tools

A

cockpit : connect via : http://{IP-addr}:9090

VNC: Virtual Network Computing offering complete access to remote desktop w/ client-server model giving remote admin complete access

XRDP: Microsoft RDP protocol

X FORWARDING: X Windows System (X11) for Linux systems and is self aware. Can forward X traffic through SSH

86
Q

iftop cmd

iftop [options] [-i {interface}]

A

display bandwidth usage

87
Q

iperf cmd

A

test maximum throughput an interface will support

On the server run:
iperf -s
On the client run:
iperf -c {server address}

88
Q

resolvectl cmd

resolvectl query {domain-name}

A

manually query name resolution services to confirm addresses and names are accurately
returned

89
Q

dig cmd name

A

can test DNS by outputting ip-addr mapped to domain names, the DNS server that answered the query, and how long it took to receive answer

The command:
dig @{IP address} {domain name}

The basic syntax:
dig {domain name}

90
Q

nslookup cmd

nslookup {domain name}

A

test name resolution

91
Q

host cmd

A

gather info and testing name resolution and even against a DNS server using its ip-addr

The command:
host {domain name} {IP address}

The basic syntax:
host {domain name}

92
Q

WHOIS cmd

A

name resolution protocol queries DNS servers to display hostname, FQDN, IP-addr, and other info

whois [options] {domain name}

93
Q

clear ARP entry

A

arp -d {ip-addr}

pinging will re-enter entry to trouble shoot

arp -a views cache