Linux File System PDF
Document Details
Uploaded by DazzledKansasCity
Vietnam National University Ho Chi Minh City International University
Le Hai Duong, PhD
Tags
Summary
This document explains the Linux file system, terminology, commands, and compression techniques. It's a great introduction/guide to file systems for students.
Full Transcript
System & Network Administration Navigating the Linux File System Le Hai Duong, PhD. ([email protected]) File System Terminology The file system is a logical way to describe the collection of storage devices which, combined, make up the system’s file space. The word logical is use...
System & Network Administration Navigating the Linux File System Le Hai Duong, PhD. ([email protected]) File System Terminology The file system is a logical way to describe the collection of storage devices which, combined, make up the system’s file space. The word logical is used to denote the user’s view of the file system, which is a collection of partitions, directories, and files. Partition: a disk partition is a logical division of the collection of storage devices into independent units. Directory: a user-specified location that allows a user to organize files. In Linux, files and directories are treated similarly. File: the basic unit of storage in the logical file system, the file will either store data or an executable program. File System Terminology (conti.) Path: a description of how to reach a particular file or directory. ○ absolute: starting at the Linux file system root (/) ○ relative: starting at the current working directory inode: a data structure stored in the file system used to represent a file. The inode itself contains information about the file (type, owner, group, permissions, last access/create/ modification date, etc.) and pointers to the various disk blocks that the file contains. Link: a combination of a file’s name and the inode number that represents the file. ○ link → file’s inode → file’s blocks A Hierarchical File System Top-level directories named /bin, /boot, /dev, /etc, /home, /lib, /tmp, /usr, /var User’s own directory is under /home The Path ○ absolute: starting at the Linux file system root (/) ○ relative: starting at the current working directory Specifying Paths above and below the Current Directory The current directory: single period. A directory above the current directory:.. Current user’s home directory: ~ ○ ~zappaf denotes /home/zappaf Commands: basename, dirname Specifying Filenames with Wildcards Specifying Filenames with Wildcards (conti.) Linux File Commands File Movement and Copy Commands Textfile Viewing Commands File Comparison Commands to compare file1 to all of file2, file3, file4, and file5 will compare file1 and file2, starting at byte 101 of file1 and 151 of file2, comparing 1024 bytes. to searching for consecutive duplicate lines and remove any such duplicates File Manipulation Commands join: join two files together when the files contain a common value (field) per line paste: combine the contents of the files, line by line split: split a file into numerous smaller files cut: view partial contents of a file Other File Commands of Note wc: count the characters, words, and lines in a text file touch: command creates an empty text file sort: sort the entries LOCATING FILES The Find Command The find command’s format is e.g. The Find Command (conti.) Other Means of Locating Files which: to locate an executable program whereis: to locate a program’s location. But whereis does not rely on the PATH variable locate and slocate: to access a database storing file locations FILE COMPRESSION Types of File Compression lossy lossless The LZ Algorithm for Lossless Compression Searching for repeated strings in the original file and then replacing those strings with shorter strings ○ e.g., Lempel Ziv (LZ) algorithm Other Lossless Compression Algorithms gzip program is based on the LZ77 and Huffman codes ○ gunzip or gzip –d: decompress bzip2 program uses the Burrows–Wheeler sorting algorithm combined with Huffman codes for compression ○ bunzip2 or bzip2 –d : decompress zip program which is used to both bundle and compress files ○ unzip: to unzip