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
index node (inode)
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.
26
ln --backup -f -s -i -v
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.
27
difference between hard and symbolic links
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
28
"." ".."
. - current dir .. - previous dir
29
tree command -a -d -s -D
display file system in familial structure -a all files including hidden -d dir only -s display file size -D display last modification date
30
ls -a -l -d -R -s
list files: -a all contents including hidden -l in long format -d dir only -R contents of subdir -s display file sizes
31
rm -f -i -R
-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
32
difference with rm and rmdir
rmdir specifies dir and only removes the dir; the contents are then placed in the location its parent dir originally existed
33
head/tail -n
specify number of lines with a space and #
34
tee command command [options] [arguments] | tee [options] {file names}
reads the input and both prints and sends (think of it as redirects) output to each specified file -a appends
35
xargs command definition and process command [options] [arguments] | xargs [options] {command}
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
36
xargs options -I( uppercase i) -L -p n -E -t -s
-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
37
find format and options
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
38
locate command
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
updatedb command
build and update database of files based on /etc/update.conf
40
/etc/update.conf /var/lib/mlocate/mlocate.db
.conf can be changed and set to exclude dir for indexing. (link?) /var is where the db is located.
41
which command
displays path of a specified command
42
printf command
like echo but allows more control using "\n" "\" indicates format characters like newline
43
tr command
translate a string replacing {character1} with {character2}
44
wc command -c -m -l -w
word count command -c byte count -m character count -l newline count -w work count
45
sort command -k{column #} -n - r -t{delimiter}
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
cut command -c -d{delimiter} -f{files #} -s
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
paste command
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
diff command -b -i -t -w -c -u
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
awk command def and operations awk [options] ['patterns {actions}'] {file-names}
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
awk examples
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
sed command [options]: d, "-n,p", s "s,g" sed {'option/address/ action'} {file-names}
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
IP [subcmds]: l , a , r, n
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
modifying IP addr
Ip addr {show} {add| del} {Address/cidr} dev {interface name} ip -4/6 addr to show only ipv4/6
54
modify network interfaces
Ip link {show} {set| add| del} dev {exit interface} {up|down}
55
alter routing table
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
route cmd
can also add a route with : route {add| del} -net {net ID/CIDR} netmask {subnet mask} dev {interface}
57
ifconfig ip addr assign
ifconfig [interface-name] [ip-address] netmask [subnet-mask] secondary ip addr: ifconfig [interface-name]:0 [ip-address] netmask [subnet-mask]
58
ifconfig enable or disable interface
ifoncifg {interface} {up| down}
59
if config change mac addr
ifconfig {interface} hw ether {mac-addr (":" delimiter)}
60
ifcfg command
ip and ifconfig alternate but lest robust
61
iwconfig command nick, mode, freq, channel, retry
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
nmcli [subcmds]
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
nmtui cmd
text based user interface to configure network options
64
GNOME Network Manager applet
networkmanager GUI tool on GNOME desktop
65
where are network config stored?
in many files and dir found in /etc/sysconfig or /etc/network for many Debian derivatives
66
what is /etc/sysconfig/network file
configures hostname, and gateway info, and if networking should enable at boot
67
what is /etc/sysconfig/network-scripts dir
config files for NICS, bonds, bridges in the form of ifcfg- as a per interface basis e.x. static or dynamic IP enables or disabled etc. previous tools better manage files than editing file directly
68
ethtool cmd -S -i -t -s -f
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
where is primary DHCP client config file
/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
dhclient cmd
manages current config: alone send broadcast DHCPDiscover -r release current IP config
71
how is DNS managed
in /etc/host file or via DNS server
72
hostnamectl cmd
view system hostname set hostname with hostnamectl set-hostname {hostname}
73
what is /etc/host file
system file recording association of IP addr to hostnames in that order e.x. connecting to experimental server no registered on network
74
what is /etc/resolv.conf file?
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
what is /etc/nsswitch.conf file?
specifies the order to resolve hostnames and ips format: host: (tab) {1st} {2nd} {myhostname} ex: hosts: (tab) /etc/hosts dns myhostname
76
ssh files
/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
what is ~/.ssh/config ?
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
what is ~/.ssh/authorized_keys ?
stores keys on the remote SSH servers the client connects to for key based authentication file on the remote server not host
79
what is ~/.ssh/known_hosts ?
file that stores public keys of remote systems client connected to. located local SSH client to protect from man-in-middle
80
how to configure key based authentication?
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
SSH port forwarding
tunneling an application through SSH e.x. VNC on port 5900
82
SCP tool and cmd
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
sftp cmd
SSH FTP uses SSH tunnel sftp {username}@{ip-addr of remote host}:{file}
84
rsync cmd
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
remote GUI tools
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
iftop cmd iftop [options] [-i {interface}]
display bandwidth usage
87
iperf cmd
test maximum throughput an interface will support On the server run: iperf -s On the client run: iperf -c {server address}
88
resolvectl cmd resolvectl query {domain-name}
manually query name resolution services to confirm addresses and names are accurately returned
89
dig cmd name
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
nslookup cmd nslookup {domain name}
test name resolution
91
host cmd
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
WHOIS cmd
name resolution protocol queries DNS servers to display hostname, FQDN, IP-addr, and other info whois [options] {domain name}
93
clear ARP entry
arp -d {ip-addr} pinging will re-enter entry to trouble shoot arp -a views cache