红联Linux门户
Linux帮助

linux文件系统介绍及file和ls命令

发布时间:2007-07-23 00:35:23来源:红联作者:sentialPIM
linux系统的主要文件类型
文本文件 数据文件 源代码文件 可执行文件 shell程序 链接 设备文件
常见的文件类型的扩展名
扩展名 文件类型
.l/.n 在线手册库
.a 档案或库
.c c源程序
.cc c++源程序
.csh c shell脚本
.f fortran源程序
.ksh Korm shell 脚本
.o 源代码编译而成的目标文件
.ps postscrip源文件
.shar shell 档案
.sh Bourne shell 脚本
.tar tar 档案
.txt ASCII 文本文件
.Z 压缩文件


2.文件系统布局
-----/home(用户目录)
|
-----/stand or /kernel(内核)
|
-----/var(动态信息如日志文件)
|
-----/mnt(本地装配点)
|
-----/tmp(临时文件)
/----|
root -----/etc(主机特定的装配文件)
|
-----/dev(设备文件)
|
-----/sbin(引导和装配其他系统的最小命令)
|
-----/usr(操作系统命令)
|
-----/opt-------------Appn(应用程序)

3.file命令
file [filename]
例如:
[monkey@localhost ~]$ file *
aa: directory
config.log: UTF-8 Unicode English text, with very long line
date: UTF-8 Unicode text
Desktop: directory
KDE-die: ASCII text
libtool: Bourne shell script text executable
new_script: ASCII text
practice: UTF-8 Unicode English text
Robot: directory
Screenshot.png: PNG image data, 1280 x 1024, 8-bit/color RGBA, non-interlaced
system: directory
workspace: directory

4.ls命令
[monkey@localhost ~]$ ls
aa date KDE-die new_script Robot system
config.log Desktop libtool practice Screenshot.png workspace
没有参数的ls命令只列出了一般文件的名字,对于隐藏文件或一些系统文件则不可见。
[monkey@localhost ~]$ ls -a
. .config .gconfd .lesshst practice .Trash
.. config.log .gnome libtool .purple .viminfo
aa date .gnome2 .local .qt .vnc
.assistant Desktop .gnome2_private .macromedia .recently-used .wapi
.bash_history .dmrc .gpilotd .mcop .recently-used.xbel workspace
.bash_logout .eclipse .gpilotd.pid .mcoprc .redhat .xsession-errors
.bash_profile .eggcups .gstreamer-0.10 .metacity Robot .zshrc
.bashrc .emacs .gtkrc-1.2-gnome2 .mozilla .scim
.beagle .esd_auth .ICEauthority .nautilus Screenshot.png
.cache .evolution .kde new_script system
.chewing .gconf KDE-die .openoffice.org2.0 .thumbnails
-a 这个参数可以类出当前目录下的所有文件。
[monkey@localhost ~]$ ls -l
总计 1292
drwxrwxr-x 6 monkey monkey 4096 07-13 07:06 aa
-rw-rw-r-- 1 monkey monkey 37559 07-13 07:14 config.log
-rw-rw-r-- 1 monkey monkey 43 05-25 02:43 date
drwxr-xr-x 2 monkey monkey 4096 07-22 21:53 Desktop
-rw-rw-r-- 1 monkey monkey 7371 05-22 23:47 KDE-die
-rwxrwxr-x 1 monkey monkey 230637 07-13 07:14 libtool
-rwxrwxr-x 1 monkey monkey 42 05-25 03:16 new_script
-rw-rw-r-- 1 monkey monkey 576 05-25 05:08 practice
drwxrwxr-x 8 monkey monkey 4096 05-27 21:50 Robot
-rw-rw-r-- 1 monkey monkey 947032 07-11 23:44 Screenshot.png
drwxrwxr-x 2 monkey monkey 4096 05-25 02:47 system
drwxr-xr-x 3 monkey monkey 4096 05-18 20:02 workspace
-l 这个参数是列出文件的详细信息包括权限,拥有者等。而在-l后面加一个文件名就列出此文件的信息。
[monkey@localhost ~]$ ls -p
aa/ date KDE-die new_script Robot/ system/
config.log Desktop/ libtool practice Screenshot.png workspace/
-p 这个命令会把当前目录下的子目录用/标识出来。
-R 这个命令会把子目录的文件都一一列出来,由于太长,这里就不举例举了。
-c 按文件最后一次修改时间列出。
-d 只列出文件名。
-i 在第一栏列出inode号。
最后,这些参数都可以组合来使用,也可以指定某一文件。
文章评论

共有 6 条评论

  1. woka 于 2009-07-13 16:51:18发表:

    学习,受教育了

  2. langhaife 于 2009-07-13 15:29:26发表:

    真狠 你老厉害拉 以后多多请教 哈哈

  3. LiuCan007 于 2009-04-11 01:01:28发表:

    从哪弄的
    难道是自己原创

  4. 同风 于 2009-04-10 14:22:38发表:

    支持,我认为你太厉害了

  5. 张成铭 于 2009-04-10 10:06:54发表:

    好像很深奥,先看一看

  6. 唐军 于 2007-07-23 11:14:15发表:

    :0L :0L