Linux File System Basics

Part of the Linux All-in-One For Dummies Cheat Sheet

To interact with the Linux file system, you must understand some basics: its key directories, some of the most commonly used commands, and the permissions you can assign to files.

  • Key directories in the file system:

    • */: Root directory (base of file system)

    • /bin: Executable programs

    • /boot: Linux kernel and boot loader

    • /dev: Special device files

    • /etc: System configuration files

    • /home: Home directories of all users

    • /lib: Library files for programs

    • /media: Mount points for CD-ROM and other media

    • /root: Home directory of the root user

    • */sbin: System administration commands

    • /srv: Data for services such as Web and FTP

    • */tmp: Temporary directory

    • /usr: Many of the important administration programs

    • /var: Various system files, such as logs

  • Common commands:

    • cat: Copies a file to the standard output

    • cd: Changes the current directory

    • chmod: Changes file permissions

    • chown: Changes file ownerships

    • cp: Copies files

    • dd: Copies blocks of data

    • df: Reports disk space usage by device and available space

    • diff: Compares two text files

    • du: Reports disk space usage by directory

    • file: Displays the type of data in a file

    • find: Finds files based on specified criteria

    • grep: Searches for text in a file

    • ln: Links a filename to an alias name

    • ls: Displays the contents of a directory

    • mkdir: Creates a directory

    • more: Displays a text file, one page at a time

    • mount: Mounts a file system

    • mv: Renames or moves a file

    • pwd: Displays the current directory

    • rm: Deletes files

    • rmdir: Deletes directories

    • sort: Sorts lines in a text file

    • split: Splits a file into smaller parts

    • umount: Unmounts a file system

    • wc: Counts the words and lines in a file

  • File permissions:

    • rwxrwxrwx: Three sets of rwx. The leftmost set pertains to the owner, the middle set is for the group, and the rightmost set is for others; rwx stands for read (r), write (w), execute (x); the dash (-) means no permission.

    • rwx------: Only the owner can read, write, and execute.

    • rw-r--r--: Everyone can read, and the owner can also write.

    • rw-------: Only the owner can read and write.

    • r--r--r--: Everyone can read.

    • Permissions can also be expressed numerically, where read (r) is equal to 4, write (w) is equal to 2, execute (x) is equal to 1, and no permission is equal to 0. Therefore, rwxrwxrwx is equal to 777, rwx------ is equal to 700, rw-r--r— is equal to 644, rw------- is equal to 600, and r--r--r-- is equal to 444.

  • Add a Comment
  • Print
  • Share
blog comments powered by Disqus

Linux All-in-One For Dummies Cheat Sheet


Inside Sweepstakes

Win $500. Easy.