关于   小悟志   网站地图   归档   友情链接   联系   Feed

   云上小悟  +  

在Linux中,一切都是文件!

2017年5月29日 / 22次阅读  InfoTech
标签:Linux

拍拍贷

文章《在Linux中,一切都是文件!》的特色图片

Everyone knows what a files is... It's that "photo", "document", or "music" that you use. Programs are made of files, in fact, the whole Linux operating system is just a collection of files... But, now for the weird part. Not only is that digital photo that you uploaded to your computer a file, but your monitor is a file too! You see, in Linux, everything is a file! WOW!!! How can that be? Let's try to explain it.

好吧,在Linux系统中,你的显示器也是一个文件,一切都是文件。

The /dev directory

You'll see a lot of yellow outlined in black. These are the devices that your system uses or can use. Everything is considered a file in Linux, so your hard disk is kept track of as a file that sits there. If you're using an IDE hard drive (as opposed to SCSI), your hard drive will be known as /dev/hda. Don't delete that, because your hard disk will spin around, come jumping out of your computer, land on the floor and spill out ooze all over the place. No, not really. You will probably not have to look in /dev very much, so don't worry about that.

/dev目录中是你的电脑系统中的各种设备,都是一个个的文件。

推荐阅读:

Linux /dev/null 简介

Linux特殊文件/dev/zero简介

The /boot directory

Will get you into the /boot directory. You will not find any boots or shoes or footwear of any kind there. That's where the Linux kernel usually is. Power users may change the location of the kernel for reasons of their own (they may prefer /shoe), but it is normally placed there on most systems. You will eventually have to use this directory, because you may need to use two or more different types of kernels in the future. That will be taken up in a more advanced lesson.

/boot目录下没有鞋子靴子之类的玩意儿,这个目录下一般是Linux内核所在地。

root's directory /root
If you are not working as 'root' and you type cd /root, you will be taken to the directory /root. However, you won't be able to do anything while you're there. Root's home directory is a restricted area for everybody else. Linux response is sort of like, 'You don't have to know that'. Users' home directories are under certain restrictions for other users as well.

/root目录是root用户专有的,任何其他人都不能访问。(如果你把网站路径放入这个目录,网络来访也会被限制,请参考:wordpress网站迁移遇到的问题 文章中描述的第3个问题)

The /sbin directory

/sbin is another one of those off-limits directories. You may look, but you can't touch. This directory is like /bin in that it has frequently used programs in it, but they're only meant to be used by root. 'Shutdown' is in there. Only root can shutdown the system. If a user other than root tried to shutdown the system, he or she would get a message saying that only root can do that. Then that person would be followed by the secret police for three months.

/sbin下的程序是给root用户用的,例如shutdown。

/bin下的程序,谁都可以用。

The /tmp directory

/tmp is a directory that is used to store temporary files, as the name may suggest. You will find later on that when you use a Windows-style system with Linux like KDE, this window manager will create files there for temporary use. When you double click on an icon of a photo, the photo comes up for you to see but a temporary file is created while you're looking at the photo. The temporary file is deleted when you close the KDE image program. It's mainly the programs that work under a windows manager that take advantage of this directory.

/tmp顾名思义啦。

The /var directory

/var is a directory for certain files that may change their size (i.e. variable size) For example, there are a few excellent databases for Linux. One is called MySQL. Normally, MySQL keeps its data in a subdirectory of /var called /var/mysql/. If I had an e-commerce website, I would have a database to register purchases. That database would obviously grow in size. And if it didn't then I'd be in trouble. It is also the normal place where email servers store their incoming mail. Again, email varies in size as well.

/var目录存放那些体积会变化的文件,例如mysql数据库的data,或者有个邮箱系统的inbox。(这样有啥意义呢?)

The /lib directory

/lib is for library files. That's where the name /lib comes from. Programs may use libraries to carry out their functions. Different programs use the same libraries, so Linux will store them here so that every program knows where to find them. You will probably not have to worry about this directory much unless you start getting messages like 'can't find shared library...'. That will sometimes happen when you've downloaded a program and had to compile it yourself from source. Even then, getting what are known as "dependency" problems are quite rare. Most programs, even when compiled from source, usually have a pre-configuration program that makes sure that they can find what libraries they "depend" on to run. If they don't, they'll tell you that you can't install the program.

/lib,用来存放各种库的目录。

The /home directory (home sweet home!)

We talked about /home before. This is a directory for storing users' personal files. All of us have certain preferences for using programs. These preferences are usually included in configuration files which are also stored in users' home directories. Most of these files start with a '.' (period/dot).

/home,每个用户一人一个,存放个性化的配置信息。

使用命令cd ~,可以直接回到自己的home目录。

/etc目录

Usually contain the configuration files for all the programs that run on your Linux/Unix system.

etc不是什么缩写,是and so on的意思 来源于 法语的 et cetera 翻译成中文就是 等等 的意思. 至于为什么在/etc下面存放配置文件, 按照原始的UNIX的说法(linux文件结构参考UNIX的教学实现MINIX) 这下面放的都是一堆零零碎碎的东西, 就叫etc, 这其实是个历史遗留.这个目录一般用来存放程序所需的整个文件系统的配置文件.

比如,hosts文件的位置:/etc/hosts

本文链接:http://www.maixj.net/ict/linux-wenjian-15566
云上小悟 麦新杰(QQ:1093023102)

-- (*^-^*) --

相关文章

评论是美德

无力满足评论实名制,评论对非实名注册用户关闭,有事QQ:1093023102.


前一篇:
后一篇:

栏目精选


©Copyright 麦新杰 Since 2014 云上小悟独立博客版权所有 备案号苏ICP备14045477号-1

网站二维码
拍拍贷
go to top