The Linux Filesystem Explained | How Each Directory is Used

00:14:08
https://www.youtube.com/watch?v=P0QZnAnsQ4c

概要

TLDRThis video serves as a guide for newcomers to Linux, providing an overview of the various directories found in a Linux filesystem and their purposes. Veronica, a system administrator and Linux advocate, explains that the Linux file system is structured into directories that contain files, configurations, and system data. Key directories covered include: - *bin*: Contains executable programs and core commands. - *boot*: Houses bootloader files and kernel components. - *dev*: Contains device files for physical and virtual connected devices. - *etc (or etsy)*: Holds critical configuration files and startup scripts. - *home*: Contains personal user directories and settings. - *lib*: Stores shared libraries needed by programs. - *media & mnt*: Mount points for removable and temporary devices. - *proc*: Pseudo-filesystem with process and system info. - *sys*: Provides structured info on devices and kernel features. - *usr*: Main directory for installed programs and utilities. - *var*: Contains log files and other variable data. The video underscores the importance of flexibility as some directory conventions may vary across different systems. It also highlights the utility of the 'ls' command for listing directory contents and introduces the Linode cloud platform as a resource for exploring Linux. Lastly, viewers are invited to take advantage of a $100 credit offer for new Linode users.

収穫

  • 📂 Understanding the Linux file system hierarchy is key for system management.
  • 🔍 The 'ls' command is essential for listing directory contents.
  • 🗄️ The 'bin' directory contains vital executable programs.
  • 🛠️ 'dev' directory showcases device files indicating connected hardware.
  • 🗃️ 'etc' holds the system's critical configuration files.
  • 🏠 'home' directory is for user-specific files and configurations.
  • 📀 'media' is for mounting removable media like USB drives.
  • 🔄 Flexibility is crucial due to varying filesystem conventions.
  • ⚙️ 'proc' directory offers insight into active processes and system info.
  • 💼 The 'usr' folder contains many of the system's user programs.

タイムライン

  • 00:00:00 - 00:05:00

    Newcomers to Linux may find its file system structure overwhelming compared to systems like Windows. The video, led by Veronica, introduces the basics of the Linux file hierarchy, essential for effective management and administration. It highlights the use of the 'ls' command to visualize the directory structure, focusing on key directories like '/bin' for executables, '/boot' for bootloader files, '/dev' for device files, and '/etc' for critical configuration files. Understanding these directories is crucial for Linux server management.

  • 00:05:00 - 00:14:08

    Continuing from the overview, additional directories are explored, such as '/home' for user files, '/lib' for shared libraries, and others like '/media', '/mnt', and '/srv' for different types of storage needs. The tutorial emphasizes the flexibility within Linux's structure, acknowledging variations across systems. The video encourages viewers to explore further resources, like the Linux file system hierarchy specification, for deeper understanding, and invites them to try Linode’s platform with a promotional offer to gain practical Linux experience.

マインドマップ

ビデオQ&A

  • What is the purpose of the 'bin' directory in Linux?

    The 'bin' directory contains important executable programs and core operating system commands.

  • What can be found in the 'boot' directory?

    The 'boot' directory contains files needed by the bootloader, including the initial ram file system and the kernel.

  • Why is the 'dev' directory important?

    The 'dev' directory contains device files which represent physical and virtual devices connected to the system.

  • What is stored in the 'home' directory?

    The 'home' directory contains individual user home directories and user-specific configuration files.

  • What does the 'opt' directory contain?

    The 'opt' directory is used for optional software packages, usually placed by a vendor.

  • What information does the 'proc' directory provide?

    The 'proc' directory provides information about running processes and system information.

  • What is the 'usr' directory used for?

    The 'usr' directory contains most of the programs and utilities that the system runs.

  • What files can be found in the 'var' directory?

    The 'var' directory contains system-specific variable files such as logs, temporary message files, and spool files.

  • What is the role of the 'sys' directory?

    The 'sys' directory contains information about devices, drivers, and kernel features.

  • Why is flexibility important when navigating the Linux file system?

    Flexibility is important because the conventions for directory usage aren't always strictly followed and can vary between systems.

ビデオをもっと見る

AIを活用したYouTubeの無料動画要約に即アクセス!
字幕
en
オートスクロール:
  • 00:00:00
    folks coming to linux for the first time
  • 00:00:02
    often wonder what's going on with all of
  • 00:00:03
    these directories in the file system if
  • 00:00:06
    you're expecting a c drive this list of
  • 00:00:08
    directories can certainly feel
  • 00:00:10
    overwhelming
  • 00:00:12
    no worries let's go through it together
  • 00:00:15
    [Music]
  • 00:00:23
    greetings and welcome back to lenode my
  • 00:00:26
    name is veronica and i'm a system
  • 00:00:28
    administrator linux mom and lino
  • 00:00:31
    developer advocate
  • 00:00:33
    and today i'd like to share some basics
  • 00:00:35
    about the linux file system and how it's
  • 00:00:38
    designed to be useful in the effective
  • 00:00:40
    management of your linux system
  • 00:00:42
    linux and unix systems display files
  • 00:00:45
    configuration and system information in
  • 00:00:48
    a hierarchy of folders
  • 00:00:50
    understanding how these files and
  • 00:00:52
    folders work together is a vital part of
  • 00:00:55
    getting comfortable with a linux server
  • 00:00:57
    pretty much any linux administrator is
  • 00:00:59
    going to be spending some time in these
  • 00:01:01
    folders so let's dive into the basics
  • 00:01:03
    together if you want to see the folder
  • 00:01:06
    structure for yourself the easiest way
  • 00:01:08
    is to use the ls command
  • 00:01:11
    the ls command lists out files in a
  • 00:01:13
    directory and is a pretty useful command
  • 00:01:16
    i'm going to use it right here on a
  • 00:01:18
    fresh rocky linux 8 linode to show off
  • 00:01:21
    all the typical directories
  • 00:01:23
    by the way if you don't already have a
  • 00:01:26
    linux account and want to try out the
  • 00:01:27
    platform stay to the end to learn how
  • 00:01:30
    you can get a 100 dollar 60-day credit
  • 00:01:33
    on your new linux account
  • 00:01:35
    anyway here in my terminal i'm using the
  • 00:01:38
    ls command followed by a forward slash
  • 00:01:42
    this command lists out the root
  • 00:01:44
    directory and when i press enter you'll
  • 00:01:47
    see the directories we're about to get
  • 00:01:49
    to know
  • 00:01:50
    now i should note real quick that these
  • 00:01:52
    folder descriptions are conventional but
  • 00:01:55
    they're not always strictly followed
  • 00:01:57
    there's a degree of interpretation here
  • 00:02:00
    so flexibility is your friend with that
  • 00:02:03
    let's take a look
  • 00:02:05
    bin
  • 00:02:06
    bin is a directory which contains
  • 00:02:08
    important executable programs and core
  • 00:02:11
    operating system commands
  • 00:02:14
    in modern linux distributions this
  • 00:02:16
    directory tends to be symbolically
  • 00:02:18
    linked to slash user slash bin which
  • 00:02:22
    we'll cover in a minute
  • 00:02:23
    listing out this folder shows tons of
  • 00:02:26
    programs we use every day including
  • 00:02:28
    right there the ls command itself
  • 00:02:33
    boot
  • 00:02:34
    boot is unsurprisingly the directory
  • 00:02:38
    which contains the files needed by the
  • 00:02:40
    bootloader
  • 00:02:41
    the initial ram file system also lives
  • 00:02:43
    here as well as the kernel
  • 00:02:46
    as you can imagine the boot directory
  • 00:02:48
    isn't a directory you should be playing
  • 00:02:50
    with unless you know what you're doing
  • 00:02:53
    dev
  • 00:02:54
    dev contains your device files these
  • 00:02:57
    files are dynamically created based on
  • 00:02:59
    the various physical and virtual devices
  • 00:03:02
    that are connected to your system
  • 00:03:04
    you may have heard the expression that
  • 00:03:06
    in linux everything is a file or
  • 00:03:09
    directory well dev demonstrates that
  • 00:03:12
    pretty well
  • 00:03:13
    here on my linux desktop for example
  • 00:03:16
    when i run ls dash l slash dev slash
  • 00:03:21
    nvme asterisk i can see some very basic
  • 00:03:25
    info about the two nvme drives my
  • 00:03:28
    desktop has
  • 00:03:30
    i can tell that nvme 0 has four
  • 00:03:33
    partitions while nvme 1 has a single
  • 00:03:37
    partition
  • 00:03:39
    as you can see files and folders in the
  • 00:03:41
    dev directory give you valuable
  • 00:03:44
    information about what's connected to
  • 00:03:45
    your system and we use this information
  • 00:03:48
    frequently as we manage our servers
  • 00:03:51
    etsy
  • 00:03:52
    the etsy directory contains your
  • 00:03:54
    critical configuration files and startup
  • 00:03:57
    scripts when you manage a linux server
  • 00:04:00
    you spend a lot of time in this
  • 00:04:02
    directory
  • 00:04:03
    for example here if i want to update the
  • 00:04:06
    ssh settings on my server i'll be doing
  • 00:04:08
    that by editing the file located at
  • 00:04:11
    slash etsy slash ssh slash sshd
  • 00:04:16
    underscore config
  • 00:04:18
    i should note that the pronunciation of
  • 00:04:20
    this directory varies from person to
  • 00:04:22
    person i've always called it at c and
  • 00:04:25
    that's how i hear it referenced a lot of
  • 00:04:27
    the time but others might call it etc or
  • 00:04:30
    etc
  • 00:04:32
    none of these are wrong
  • 00:04:34
    home
  • 00:04:36
    the home directory is the location of
  • 00:04:38
    the individual user home directories if
  • 00:04:41
    you're used to the windows environment
  • 00:04:43
    you might be familiar with a my
  • 00:04:45
    documents directory and this is a
  • 00:04:47
    similar directory in the linux world
  • 00:04:50
    under normal conventions each typical
  • 00:04:52
    user on your machine gets a directory
  • 00:04:54
    inside the home folder a typical user
  • 00:04:57
    cannot see the contents of another
  • 00:05:00
    user's home directory
  • 00:05:02
    traditionally when you open up a linux
  • 00:05:04
    terminal the directory you're starting
  • 00:05:06
    in is your personal home directory
  • 00:05:09
    that's what the little tilde means here
  • 00:05:11
    in the prompt
  • 00:05:12
    it's noteworthy that the home directory
  • 00:05:14
    also contains configuration files
  • 00:05:16
    specific to the user for example here i
  • 00:05:19
    can see my bash profile configuration
  • 00:05:25
    the lib directories hold the shared
  • 00:05:27
    libraries your system's programs will
  • 00:05:29
    need
  • 00:05:30
    these shared libraries enable multiple
  • 00:05:32
    programs to share code with each other
  • 00:05:34
    which is a neat efficiency boost
  • 00:05:37
    depending on your system you might have
  • 00:05:39
    a few directories which start with lib
  • 00:05:42
    lib 32 and lib64 are pretty common
  • 00:05:45
    referring to libraries for 32 and 64-bit
  • 00:05:48
    programs respectively
  • 00:05:49
    different systems handle this
  • 00:05:51
    differently again like i said
  • 00:05:53
    flexibility is your friend
  • 00:05:56
    and like the bin directory chances are
  • 00:05:59
    it's going to be symbolically linked
  • 00:06:01
    this time to the user slash lib
  • 00:06:04
    directory
  • 00:06:06
    lost and found
  • 00:06:08
    the lost and found directory is a place
  • 00:06:10
    where chunks of broken files might
  • 00:06:12
    reside after a system crash generally
  • 00:06:14
    speaking we don't want to intentionally
  • 00:06:16
    put files in there
  • 00:06:18
    media
  • 00:06:19
    the media directory is the mount point
  • 00:06:21
    for file systems stored on removable
  • 00:06:23
    media
  • 00:06:24
    for example here i have a flash drive
  • 00:06:27
    which i've formatted with the name neat
  • 00:06:29
    backups when i plug it into my computer
  • 00:06:32
    and use the command ls
  • 00:06:34
    slash media slash vkc
  • 00:06:38
    vkc being my username on this machine
  • 00:06:40
    i can see the neat backups device here
  • 00:06:44
    typically when your linux system auto
  • 00:06:46
    mounts a device such as a usb drive this
  • 00:06:49
    is where you'll find it
  • 00:06:51
    mount
  • 00:06:52
    the mount or mnt directory is where
  • 00:06:55
    you'll mount devices temporarily
  • 00:06:57
    for example if you want to temporarily
  • 00:07:00
    attach a network storage server to
  • 00:07:02
    archive some files this is typically
  • 00:07:04
    where you'll mount it
  • 00:07:06
    it should be noted that although the
  • 00:07:08
    intention is for this to be where
  • 00:07:09
    temporary mounting takes place some
  • 00:07:12
    systems do permanently mount things here
  • 00:07:15
    again flexibility is your friend
  • 00:07:18
    opt
  • 00:07:19
    the opt directory is rarely used
  • 00:07:22
    nowadays but it's not entirely gone this
  • 00:07:25
    directory is where optional software
  • 00:07:27
    packages would be placed often by a
  • 00:07:29
    vendor when you add on to your system
  • 00:07:31
    it's mostly kept around just for
  • 00:07:33
    compatibility purposes but it's not
  • 00:07:35
    totally dead i work with cobalt and i've
  • 00:07:38
    seen this directory plenty of times
  • 00:07:41
    proc
  • 00:07:42
    the proc directory is a great example of
  • 00:07:45
    a pseudo file system a pseudo file
  • 00:07:48
    system is a file system that's created
  • 00:07:50
    at startup and disappears at shutdown
  • 00:07:53
    the proc sudo file system contains
  • 00:07:56
    information about every running process
  • 00:07:58
    on your machine
  • 00:08:00
    in fact each active process has its own
  • 00:08:03
    subdirectory in here
  • 00:08:05
    it also contains a ton of information
  • 00:08:07
    about your system for example i can use
  • 00:08:10
    the cat command to see my cpu info with
  • 00:08:13
    cat slash proc slash cpu info
  • 00:08:18
    you can learn even more about the proc
  • 00:08:20
    directory by looking at the proc man
  • 00:08:22
    page with the command man
  • 00:08:24
    proc root
  • 00:08:27
    the slash root directory is the home
  • 00:08:29
    directory for the root user that's the
  • 00:08:32
    user with the ultimate power on your
  • 00:08:34
    system
  • 00:08:35
    on most modern linuxes typical users
  • 00:08:38
    cannot view the contents of this
  • 00:08:39
    directory without sudo or switching
  • 00:08:42
    directly to the root user
  • 00:08:44
    run
  • 00:08:46
    the run directory contains information
  • 00:08:48
    describing your system since boot time
  • 00:08:50
    such as who's logged in and what demons
  • 00:08:53
    might be running
  • 00:08:54
    like the proc directory the information
  • 00:08:57
    in the run directory might be useful as
  • 00:08:59
    you're gathering information about your
  • 00:09:00
    system and how it's being used
  • 00:09:03
    s-bin
  • 00:09:04
    the s-bin directory contains system
  • 00:09:07
    essential files similar to the bin
  • 00:09:09
    directory
  • 00:09:11
    traditionally the programs in s-bin were
  • 00:09:13
    statically linked and thus had fewer
  • 00:09:15
    library dependencies but this convention
  • 00:09:18
    doesn't really fit anymore
  • 00:09:20
    in contemporary systems there's little
  • 00:09:23
    practical difference between bin and
  • 00:09:25
    s-bin
  • 00:09:27
    in fact like the bin directory s-bin is
  • 00:09:30
    often symbolically linked to slash user
  • 00:09:34
    slash bin on modern linuxes
  • 00:09:37
    srv
  • 00:09:39
    the srv directory is occasionally used
  • 00:09:42
    as a folder for files served by a web
  • 00:09:44
    server or other server mechanism such as
  • 00:09:47
    ftp
  • 00:09:49
    but this is not universally accepted and
  • 00:09:52
    honestly in my experience this is rarely
  • 00:09:55
    used in the modern era opensuse is a
  • 00:09:58
    notable exception using it as the
  • 00:10:00
    default for web servers and other uses
  • 00:10:04
    that being said most of the time you'll
  • 00:10:06
    probably just see this as a blank
  • 00:10:08
    directory
  • 00:10:10
    sys
  • 00:10:11
    the sys directory contains information
  • 00:10:13
    about the devices drivers and kernel
  • 00:10:16
    features running on your system
  • 00:10:18
    this directory is often referred to as
  • 00:10:21
    like proc but better structured and to
  • 00:10:24
    be honest i can kind of see it
  • 00:10:27
    you'll use both sys and proc frequently
  • 00:10:29
    as a linux administrator to pull
  • 00:10:32
    information about the systems you're
  • 00:10:33
    working with
  • 00:10:35
    temp
  • 00:10:36
    the temp directory is what it sounds
  • 00:10:38
    like a directory for temporary files
  • 00:10:42
    we often use this directory to store
  • 00:10:44
    things we don't intend on keeping beyond
  • 00:10:46
    the next reboot
  • 00:10:48
    there's any number of files you might
  • 00:10:49
    place here temporarily items you're
  • 00:10:51
    downloading keys you'll only briefly
  • 00:10:54
    need or even just as a terminal scratch
  • 00:10:56
    pad on the fly
  • 00:10:59
    user
  • 00:11:00
    the user or usr folder contains most of
  • 00:11:04
    the programs and utilities your system
  • 00:11:06
    will be running
  • 00:11:07
    now a quick side note folks often
  • 00:11:10
    pronounce this directory as user which
  • 00:11:12
    makes it sound like a user directory or
  • 00:11:15
    a directory of users but that's not
  • 00:11:18
    really an accurate description of it in
  • 00:11:20
    the modern era it's best to think of it
  • 00:11:23
    as the place most of your programs
  • 00:11:25
    actually reside
  • 00:11:27
    remember that slash bin folder we talked
  • 00:11:30
    about earlier well on most modern
  • 00:11:32
    systems slash bin is just a link to the
  • 00:11:35
    folder user slash bin
  • 00:11:38
    a file placed in slash bin is actually
  • 00:11:42
    being placed in user slash bin and just
  • 00:11:45
    made visible in slash bin for
  • 00:11:47
    compatibility purposes same thing with
  • 00:11:50
    slash s-bin it's just a link to user
  • 00:11:53
    slash s-bin on most modern linuxes
  • 00:11:56
    your lib directories too will usually be
  • 00:11:59
    symbolically linked here
  • 00:12:01
    because this is where the bulk of your
  • 00:12:03
    programs live it's usually shared
  • 00:12:05
    between all users and read only except
  • 00:12:08
    via root or sudo
  • 00:12:11
    var
  • 00:12:13
    lastly the var directory is your system
  • 00:12:16
    specific variable files
  • 00:12:18
    this means logs temporary message files
  • 00:12:22
    and spool files that sort of thing
  • 00:12:24
    confusingly you might occasionally find
  • 00:12:27
    configuration files here that aren't in
  • 00:12:29
    etsy
  • 00:12:30
    and this is also where web servers tend
  • 00:12:33
    to place their files apache for example
  • 00:12:36
    often serves files from the var
  • 00:12:39
    www directory
  • 00:12:42
    okay that was a lot you can of course
  • 00:12:46
    find more information about your file
  • 00:12:48
    system hierarchy by using the man page
  • 00:12:51
    for hire at man h-i-e-r
  • 00:12:57
    there's also a ton of info online such
  • 00:13:00
    as the file system hierarchy standard
  • 00:13:02
    specifications
  • 00:13:05
    again i can't say it enough flexibility
  • 00:13:08
    is your friend especially when learning
  • 00:13:10
    something complicated like the linux
  • 00:13:12
    file system
  • 00:13:15
    and one of the easiest ways for you to
  • 00:13:17
    get familiar with linux is using the
  • 00:13:19
    cloud and linode has made this so easy
  • 00:13:23
    if you're new to linode guess what
  • 00:13:25
    there's a link in the description that
  • 00:13:27
    will give you a
  • 00:13:28
    100.60 day credit for new linux accounts
  • 00:13:32
    try it out and spin up a linux instance
  • 00:13:34
    right from your browser it's super easy
  • 00:13:38
    and thank you so much for watching our
  • 00:13:41
    video make sure to leave a comment with
  • 00:13:43
    other tutorials you'd like to see on
  • 00:13:45
    this channel
  • 00:13:46
    and please don't forget to like and
  • 00:13:48
    subscribe to see more content like this
  • 00:13:51
    from your friends at lenode
  • 00:13:54
    [Music]
  • 00:14:07
    you
タグ
  • Linux
  • File System
  • Directories
  • Beginner Guide
  • Sysadmin
  • Linux Commands
  • Linux Structure
  • Bootloader
  • File Management
  • Configuration Files