悠悠秦淮

[2008年2月22日星期五]

RHCE笔记整理-RH033.Unit3--Filesystem

Linux File Hierarchy Concepts

Some Important Directories

The home directory

/root /home/username

The bin directories

/bin,/user/bin,/usr/local/bin 常用执行文件

/sbin, /user/sbin, /usr/local/sbin 系统管理可执行文件

Foreign filesystem mountpoints

/mnt amd /media

3.Other Important Directories

/etc --system config files

/tmp

/boot --kernel and bootloader

/dev --device

/usr --Programs

Lost+found --遗失的片段

/var --存放经常变动的文件,如:log,email

/srv --存放目前所有和server有关的服务

/proc --反应kernel的环境,是虚拟的目录,不占用任何磁盘空间

The lib directories

/lib,/usr/lib,/usr/local/lib

Current Working Directory (CWD)

Usage: pwd

5. File and Directory Names (文件命名规则)

Less than 255 characters

all characters are valid,except the “/”,若用空格等特殊字符作为文件名,必须用引号把这个字符括起来

Names are case-sensitive(大小写是敏感的)例如:Mail,mail mAil,是不同的文件

6. Absolute Pathnames (绝对路径)

Begin with a slash(/)

Complete “road map” to file location
//为文件位置作指向

Can be used anytime you wish to specify a file name

7. Relative Pathname

Don't begin with a slash(/)

specify location relative to your current working directory

Can be used as a thort way to specify a file

8. Change Directory

command: cd

9. Listing Directory Concents

查看当前目录本身的属性:ls -ld

10. Copying Files and Directories

Usage:

cp [options] file destination

More than one files may be copied at a time if the destination is a directory

cp [options] file1 file2 destination

cp技巧:

cp -p file dest 保持文件拷贝前的时间

11. Linux Copying Files and Directories //linux中复制行为是怎么动作的

If destination exists and is a file ,the copy overwrite the destination file

If the destination is a directory,and is exists,the copy is placed there with the same name

If the destination doesn't exist,the copy is created with that name

14. Creating and Removing Files

rm -- remove files

Usage

rm [options] file

-i --interactive(确认信息)

-r --删除目录时必用选项

-f --force

Redhat 中,rm在普通用户下使用时,默认不带-i参数,在root用户下使用时,默认会带-i参数

touch create files

若所要建立的文件已在存在,则会改变文件的修改时间,不会改变其内容。 15. Creating and Removing Directory

mkdir --create directory

rmdir --remove an empty directory

rm -r --remove a directory

16. Using Nautilus

Gnome Graphical filesystem browser

Can run in “spatial” and “Browser” mode

Spatial --open directory in each window

Browser --open all directories in one window

18. Ceterming File Content

File can contain many types of data

syntax

file [options] filenames

20. Viewing Text Page by Page

syntax:

less [options] filename

Uage:

/text --search

n/N --next/previous match

v --open file in text editor

space -next page

b --previous page

Ctrl+d --next falf page

Ctrl+u --previous half page

g --to top of the file

G --to bottom of the file

/text --find text downward

?text --find text forward

v --editor mode

q --quit

0 评论:

发表评论