4 File Management & 10 Network Settings Flashcards
/bin
stores essential command-line utilities and binaries
e.x. ls
/boot
stores files to boot system
/dev
stores hardware and software device drivers
e.x. storages devices here
/etc
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
/home
stores users’ home dir and their personal files
/lib
stores shared program libraries required by the kernel, CLI utilities and binaries
/media
stores mount points for removable media like CD-ROMS and floppy disks
/mnt
mount point for temporarily mounting file systems
/opt
stores optional files of large software packages.
often packages create sub directories
e.x. /opt/nessus contains files for Nessus vulnerability scanning programs
/proc
virtual file system representing continuously updates kernel info in a user file
e.x. /proc/mounts
/sbin
Stores binaries used for boot process and by the root user
e.x. /sbin/ifconfig used to manage network interfaces
/sys
a VFS storing info about devices
e.x. /sys/block includes links to devices that are stored in various subdir under /sys/ devices/
/tmp
stores temporary files that may be lost on system shutdown
/usr
contains important subdir
/usr/bin
/usr/bin - .exe programs that can be used by all users
/usr/local
/usr/local - custom built applications stored here by default
/usr/lib
/usr/lib - objects libraries and internal binaries needed by .exe files
/usr/lib64
/usr/lib64 - same purpose as /usr/lib but meant for b4-bit systems
/usr/share
/usr/share - contains read-only architecture independent files. can be shared among different architectures of an OS
/var
stores variable files that are expected to change constantly
e.x. log files, printer spools, and some networking services
stat command
displays file metadata
file command
displays info on the file type and application compatibility
e.x.
.pdf version info
.jpeg image info
absolute path
defines dir to traverse, starting from root of file system “/”
relative path
defines path beginning from the users current location instead of “/”
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.
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.
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
”.” “..”
. - current dir
.. - previous dir
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
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
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
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
head/tail -n
specify number of lines with a space and #
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
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
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
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