博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Linux文件系统与Windows文件系统不同的6种方法
阅读量:2509 次
发布时间:2019-05-11

本文共 6011 字,大约阅读时间需要 20 分钟。

image

Linux’s file system has quite a few differences from the Windows file system. You won’t find any drive letters or backslashes, but you will find an alien-looking layout where files can have the same name, differing only in capitalization.

Linux的文件系统与Windows文件系统有很多差异。 您不会找到任何驱动器号或反斜杠,但是会发现外观看起来有些陌生,文件可以具有相同的名称,只是大小写不同。

This isn’t an exhaustive list. It is intended for new Linux users who aren’t aware of all the differences between Linux and Windows. There are many more differences that apply.

这不是一个详尽的清单。 它适用于不了解Linux和Windows之间所有差异的新Linux用户。 还有更多不同之处适用。

目录结构 (Directory Structure)

You won’t find any Windows, Program Files, or Users folders if you start browsing around the file system on your Linux computer. (Although the /home/ directory is very similar to the Users folder.)

如果您开始在Linux计算机上浏览文件系统,则找不到Windows,Program Files或Users文件夹。 (尽管/ home /目录与Users文件夹非常相似。)

The Linux directory structure doesn’t just use different names for folders, it uses an entirely different layout. For example, on Windows, an application might store all its files in C:\Program Files\Application. On Linux, its files would be split between multiple locations – its binaries in /usr/bin, its libraries in /usr/lib, and its configuration files in /etc/.

Linux目录结构不仅为文件夹使用了不同的名称,而且还使用了完全不同的布局。 例如,在Windows上,应用程序可能会将其所有文件存储在C:\ Program Files \ Application中。 在Linux上,它将在多个位置之间分割文件-在/ usr / bin中的二进制文件,在/ usr / lib中的库以及在/ etc /中的配置文件。

We have explained what each directory on the Linux file system is and what it’s for. For the details, read:

我们已经解释了Linux文件系统上的每个目录是什么以及它的作用。 有关详细信息,请阅读:

区分大小写 (Case Sensitivity)

On Windows, you can’t have a file named file and another file named FILE in the same folder. The Windows file system isn’t case sensitive, so it treats these names as the same file.

在Windows上,同一文件夹中不能有一个名为file的文件和另一个名为FILE的文件。 Windows文件系统不区分大小写,因此会将这些名称视为同一文件。

On Linux, the file system is case sensitive. This means that you could have files named file, File, and FILE in the same folder. Each file would have different contents – Linux treats capitalized letters and lower-case letters as different characters.

在Linux上,文件系统区分大小写。 这意味着您可以在同一文件夹中包含名为fileFileFILE的文件。 每个文件将具有不同的内容– Linux将大写字母和小写字母视为不同的字符。

linux-file-case-sensitivity

反斜杠与正斜杠 (Backslashes vs. Forward Slashes)

Windows uses backslashes, just as DOS did. For example, the path to a user’s directory on Windows is:

Windows使用反斜杠,就像DOS一样。 例如,Windows上用户目录的路径为:

C:\Users\Name

C:\ Users \ Name

windows-forward-slashes

On Linux, the path to a user’s home directory is:

在Linux上,用户主目录的路径为:

/home/name

/ home /名称

linux-forward-slashes

You will also notice that URLs in your web browser – even on Windows – use forward slashes. For example, it’s https://www.howtogeek.com/article, not http:\\www.howtogeek.com\article.

您还将注意到,即使在Windows中,Web浏览器中的URL也使用正斜杠。 例如,它是https://www.howtogeek.com/article,而不是http:\\ www.howtogeek.com \ article。

没有驱动器号-全部都在/ (No Drive Letters – It’s All Under /)

Windows exposes partitions and devices at drive letters. Whether you have multiple hard drives, multiple partitions on the same hard drive, or removable devices connected, each file system is available under its own drive letter.

Windows在驱动器号处公开分区和设备。 无论您有多个硬盘驱动器,同一硬盘驱动器上的多个分区还是已连接的可移动设备,每个文件系统都可以在其自己的驱动器号下使用。

windows-drive-letters

Linux doesn’t have drive letters. Instead, it makes other file systems accessible at arbitrary directories. (Windows can do this too, but this isn’t how it works out of the box.)

Linux没有驱动器号。 相反,它使其他文件系统可以在任意目录中访问。 (Windows也可以这样做,但这不是开箱即用的方式。)

On Linux, everything is under / – the root directory. There are no files above the root directory, as there are files outside of C: on Windows. When you connect a device to your computer, it will become available under /media/. The contents of the directory display the contents of the mounted partition.

在Linux上,所有内容都位于/ –根目录下。 根目录上方没有文件,因为Windows上C:之外的文件。 将设备连接到计算机时,该设备将在/ media /下可用。 目录的内容显示已安装分区的内容。

cd-mounted-under-media-directory-in-ubuntu

If you have multiple hard drives or hard drive partitions, you could mount them anywhere you like on your file system. For example, you could place your home directories on a separate partition by mounting another partition at /home. However, you could mount a partition anywhere you like – you could even mount it at /myBackupDrive.

如果您有多个硬盘驱动器或硬盘驱动器分区,则可以在文件系统上的任何位置挂载它们。 例如,您可以通过在/ home上挂载另一个分区来将主目录放置在单独的分区上。 但是,您可以在所需的任何位置挂载分区–甚至可以将其挂载在/ myBackupDrive。

一切都是文件 (Everything is a File)

Just as every mounted file system is a directory under / (the root directory), everything on Linux is a file. For example, your first hard drive is represented by /dev/sda, your CD drive is available at /dev/cdrom, while your mouse is represented by /dev/mouse.

就像每个已挂载的文件系统都是/(根目录)下的目录一样,Linux上的所有内容都是一个文件。 例如,第一个硬盘驱动器由/ dev / sda表示,CD驱动器位于/ dev / cdrom上,而鼠标由/ dev / mouse表示。

This phrase is actually a bit of an oversimplification – everything isn’t really a file on Linux. But understanding what this phrase means will help you understand how Linux works. To learn more, read:

这个短语实际上有点过分简化了– Linux上的所有文件都不是真正的文件。 但是了解此短语的含义将帮助您了解Linux的工作方式。 要了解更多信息,请阅读:

image

您可以删除或修改打开的文件 (You Can Delete or Modify Open Files)

On Linux and other UNIX-like operating systems, applications don’t lock exclusive access to files as often as they do on Windows. For example, let’s say you’re watching a video file in VLC on Windows. The credits are playing and you’re done watching it, so you try to delete it. You’ll see an error message- – you need to stop watching the file in VLC before you can delete it, rename it, or do anything else to it.

在Linux和其他类似UNIX的操作系统上,应用程序不像在Windows上那样频繁地锁定对文件的独占访问。 例如,假设您正在Windows上的VLC中观看视频文件。 字幕正在播放,您已经看完了,因此您尝试将其删除。 您会看到一条错误消息-–您需要停止在VLC中观看文件,然后才能删除,重命名文件或对其进行任何其他操作。

image

On Linux, you could generally delete or modify the video file as it was playing. You won’t see .

在Linux上,通常可以在播放视频文件时删除或修改它。 您将不会看到 。



These differences should apply to other UNIX-like operating systems, too. There may be some differences, however – for example, Mac OS X isn’t case-sensitive. It’s case-insensitive, just like Windows.

这些差异也应适用于其他类似UNIX的操作系统。 但是,可能会有一些差异–例如,Mac OS X不区分大小写。 就像Windows一样,它不区分大小写。

翻译自:

转载地址:http://lnjwd.baihongyu.com/

你可能感兴趣的文章
ORACLE自动断开数据库连接解决办法
查看>>
不修改vender文件夹,重写laravel注册登录功能
查看>>
centos7 下通过nginx+uwsgi部署django应用
查看>>
寒假作业03
查看>>
sql优化技巧
查看>>
测试到2014-2-20命令(ADB、TOP和Monkey……)汇总
查看>>
站立会议第八天
查看>>
Spring Boot 版本支持
查看>>
关于:使用JSP+Servlet重定向网页导致CSS等失效的问题的解决
查看>>
[学习笔记]可靠信号、不可靠信号
查看>>
主窗口类
查看>>
安装JDK/SDK/Android Studio
查看>>
VMware安装步骤
查看>>
Redis源码解析:16Resis主从复制之主节点的完全重同步流程
查看>>
web开发工具IDE
查看>>
为什么要用Message Queue
查看>>
MySQL安装详解
查看>>
ASP.NET服务器推送及前后台实时交互
查看>>
vb.net 模拟UDP通信
查看>>
HDU 1104 Remainder (BFS)
查看>>