ULSAH Ch. 5

Ace your homework & exams now with Quizwiz!

Continue here

(140)

Standard directories and their contents

(Page 127)

File-type encoding used by ls

(Page 128)

Examples of chmod's mnemonic syntax

(Page 137)

Linux file attribute flags

(Page 139)

ls -ld -b -I -a -t -F -R -h

-l shows detailed information, including number of links to file -d forces ls to show information for a directory rather than its contents -b shows control characters as octal numbers -i shows each file's inode number, int associated with file contents -a includes hidden files -t sort files by modification time (-tr is reverse) -F distinguish executables and directories -R lists recursively -h is human readable first character of output encodes the type

Root directory

/ = /. = /..

Absolute vs. Relative Pathname

/tmp/foo vs. book4/filesystem

Sticky bit

1000 Used to be modifier for executable files on UNIX Now obsolete for files On directory: requires owner of directory to delete/rename file

setuid and setgid bits

4000 and 2000 Allow programs to access off-limits files to running user For directory, sets group id as opposed to user's gid

Permission bits

9 bits RWE for user, group, and then others Denoted in octal: 400, 200, 100

File attributes

9 permission bits that control read, write, execute 3 more bits control operation of executables Together they make up file's "mode" 4 more bits of file-type information

Four main components of filesystem

A namespace - a way to name things and organize them in a hierarchy An API - a set of system calls for navigating and manipulating objects Security models - schemes for protecting, hiding, and sharing things An implementation - software to tie the logical model to the hardware

Named pipes (FIFO files)

Allow communication between two processes running on the same host Created with mknod and removed with rm

Device files

Allow programs to communicate with system's hardware and peripherals Rendezvous points that communicate with device drivers Characterized by two numbers: Major and Minor device numbers

Directory Execute Bit

Allows entering or passing through but not listing contents Must also have read to list contents Must also have write to create, delete, or rename files

Filesystem Hierarchy Standard

Attempts to codify, rationalIze, and explain the standard directories for Linux systems

Binaries vs. Scripts

Binary - run directly by CPU Script - must be interpreted by shell

lsattr and chatter

Change file attributes

chmod

Change mode command

chown and chgrp

Changes file's ownership and group Must belong to group if changing group Can change both at once with chown user:group file

Local domain sockets (Unix domain sockets)

Connections between processes that allow them to communicate hygienically Accessible only from local host Created with socket system call and removed with rm command or unlink system call

Regular files

Consist of a series of bytes No structure imposed on their contents by filesystem Text files, data files, executable programs, and shared libraries Sequential access and random access allowed

Directories

Contains named references to files

ln and rm

Create and delete hard links

cp oldfile newfile

Creates a copy of oldfile called Newfie

/etc

Critical system and configuration files

. and ..

Current directory and parent directory

unmount

Detach filesystems. Complains if filesystem is in use. -l is lazy unmount and waits for file references to stop -f is force unmount and is bad idea on non-NFS systems

file command

Determine the type of a file

fuser -c mountpoint

Determines processes holding references to specific filesystem -v produces more readable output which includes commands

Pathname limits

Directories limited to 255 characters Full pathname limited to 4095 bytes on Linux and 1024 bytes on BSD

Windows filesystems

FAT and NTFS

Hard links

File's name is stored in parent directory; not within file itself All links to file are equivalent Count of links maintained by filesystem All links must be deleted to delete file

Hard links vs. soft links

Hard link is a direct reference Symbolic link is a reference by name; distinct from file

/boot

Holds the file containing the OS kernel

/var

Houses spool directories, log files, accounting information, and various other items that grow or change rapidly and that vary on each host

/sbin and /bin

Important utilities

sudo mount /dev/sda4 /users

Installs the filesystem stored on the disk partition represented by /dev/sda4 under the path /users

ctime (Change time)

Last time file attribute was changed

sudo ln -s archived/secure /var/data/secure

Links /var/data/secure to /var/data/archived/secure

/etc/fstab

Lists filesystems that are normally mounted on the system. It also serves as documentation for the layout of the filesystem on disk

Major vs. Minor device numbers

Major - tells kernel which driver file refers to Minor - Tells the driver which physical unit to address /dev/tty0 - Major 4 and minor 0

mkdir vs rmdir

Make and delete directories if empty

mount

Maps a directory within the existing file tree, called the mount point, to the root of the newly attached filesystem

ls -l and ls -ld

Mostly concerned with link count, owner, group, mode, size, last access time, last modification time, and type

/usr and /var

Needed for multiuser mode

Link count

Number of names (Hard links) for file Symbolic links don't count Always >= 2 for directories: parent directory and .

Filename vs. Pathname vs. Path

Pathname is absolute Others are absolute or relative

Symbolic Links

Points to a file by name; Stores pathname as file contents Created with ln -s and removed with rm File permissions are dummy values Create, remove, and follow controlled by directory Read, write, execute controlled by target

Directory hard links

Possible but can lead to degenerate conditions such as filesystem loops and directories that don't have a single unambiguous parent

Read, write, and execute bit

Read - file can be opened and read Write - file can be modified or truncated (not delete or rename - done by parent directory) Execute - file can be executed

rm -r

Recursively delete directories and contents

Seven types of files

Regular files Directories Character device files Block device files Local domain sockets Named pipes (FIFOs) Symbolic links

/

Root directory

Folder vs. Directory

Same thing, but use directory in technical contexts

mount (by itself)

See all the filesystems that are currently mounted

umask

Set default file permissions by specifying permissions to remove

?

Shell pattern-matching character

Difference for ls of device

Shows major and minor device numbers instead of size . at end of mode indicates no ACL list

/usr

Standard-but-not-system-critical programs along with various other booty such as on-line manuals and most libraries

/tmp

Temporary files

chmod -R a-x

Unforeseen changes due to different interpretation of execute bit for directory and flat file

rm

Universal tool for deleting files -i confirmation option

File Tree vs. Filesystem

Whole thing vs. just branches Both technically filesystems

Linux Bonus Flags

a means append only i means immutable and undeletable

FreeBSD fuser letter codes

c indicates process has current working directory on filesystem x indicates a program being executed

chmod options

chmod --reference=filea fileb chmod -R

Predominant filesystem standards

ext4, XFS, UFS and Oracle's ZFS and Btrfs

Shell lobbing (pattern matching)

rm -i foo*

Removing -f

rm ./-f or rm -- -f

Special bits

x for owner is s for setuid x for group is s for setgid x for others is t for sticky bit S or T if special is set but x isn't


Related study sets

(Unit 3C) Quiz 3C5- listening Skills

View Set

Physical Science unit 3: speedback quizzes, quizzes, and vocab

View Set

Chapter 11 - Skin, Hair, and Nails

View Set

Chapter 29: Developing the Role of Manager

View Set

Linux, Chapter 7-13 Final Review

View Set

Fundamentals- Exam 2 Practice Questions

View Set

Introduction to Computer Science Post-Test

View Set