[root@localhost ~]# ls -a /
. bin etc lost+found mnt proc selinux tmp
.. boot home media net root srv usr
.autofsck dev lib misc opt sbin sys var
[root@localhost ~]# ls -a /tmp
. .gdm_socket mapping-admin VMwareDnD
.. .gdmVCGDZW mapping-root vmware-root
.font-unix .ICE-unix orbit-root .X0-lock
gconfd-admin keyring-YxqoNK ssh-qwzOr10785 .X11-unix
gconfd-root ks-script-fvlw9H virtual-root.FQQcmy
.gdmFU25YW ks-script-fvlw9H.log vmware-admin
[root@localhost ~]# ls -l /
total 138
drwxr-xr-x 2 root root 4096 Jun 24 04:07 bin
drwxr-xr-x 4 root root 1024 Jun 23 09:45 boot
drwxr-xr-x 11 root root 4020 Jun 24 03:52 dev
drwxr-xr-x 92 root root 12288 Jun 24 04:07 etc
drwxr-xr-x 4 root root 4096 Jun 23 09:50 home
drwxr-xr-x 13 root root 4096 Jun 24 04:07 lib
drwx------ 2 root root 16384 Jun 23 09:37 lost+found
drwxr-xr-x 2 root root 4096 Jan 26 2010 media
drwxr-xr-x 2 root root 0 Jun 24 03:51 misc
drwxr-xr-x 3 root root 4096 Jun 23 09:55 mnt
drwxr-xr-x 2 root root 0 Jun 24 03:51 net
drwxr-xr-x 2 root root 4096 Jun 23 01:56 opt
dr-xr-xr-x 131 root root 0 Jun 24 03:49 proc
drwxr-x--- 14 root root 4096 Jun 24 04:17 root
drwxr-xr-x 2 root root 12288 Jun 24 04:07 sbin
drwxr-xr-x 4 root root 0 Jun 24 03:49 selinux
drwxr-xr-x 2 root root 4096 Jan 26 2010 srv
drwxr-xr-x 11 root root 0 Jun 24 03:49 sys
drwxrwxrwt 14 root root 4096 Jun 24 04:17 tmp
drwxr-xr-x 14 root root 4096 Jun 23 09:41 usr
drwxr-xr-x 22 root root 4096 Jun 23 09:48 var
[root@localhost ~]# pwd
/root
[root@localhost ~]# cd /
[root@localhost /]# pwd
/
[root@localhost /]# cd /test
bash: cd: /test: No such file or directory
[root@localhost /]# mkdir test
[root@localhost /]# pwd
/
[root@localhost /]# cd /test
[root@localhost test]# pwd
/test
[root@localhost test]# touch testfile
[root@localhost test]# pwd
/test
[root@localhost test]# ls
testfile
[root@localhost test]# ls -l testfile
-rw-r--r-- 1 root root 0 Jun 24 04:34 testfile
[root@localhost test]# cp /etc/inittab /etc/services /test
[root@localhost test]# ls
inittab services testfile
[root@localhost test]# cp -R /etc /test
[root@localhost test]# ls /test
etc inittab services testfile
[root@localhost test]# mv services service
[root@localhost test]# ls /test
etc inittab service testfile
[root@localhost test]# mv /test/inittab /tmp/
[root@localhost test]# ls /test
etc service testfile
[root@localhost test]# ls /tmp
gconfd-admin ks-script-fvlw9H orbit-root VMwareDnD
gconfd-root ks-script-fvlw9H.log ssh-qwzOr10785 vmware-root
inittab mapping-admin virtual-root.FQQcmy
keyring-YxqoNK mapping-root vmware-admin
[root@localhost test]# mv /test/testfile /tmp/file.test
[root@localhost test]# ls /test
etc service
[root@localhost test]# ls /tmp
file.test keyring-YxqoNK mapping-root vmware-admin
gconfd-admin ks-script-fvlw9H orbit-root VMwareDnD
gconfd-root ks-script-fvlw9H.log ssh-qwzOr10785 vmware-root
inittab mapping-admin virtual-root.FQQcmy
[root@localhost test]# ls /test
etc service
[root@localhost test]# rm service
rm: remove regular file `service'? y
[root@localhost test]# ls /test
etc
[root@localhost test]# touch testfile
[root@localhost test]# ls
etc testfile
[root@localhost test]# rm -f testfile
[root@localhost test]# ls
\etc
[root@localhost test]# ls
etc
[root@localhost test]# rm -rf etc
[root@localhost test]# ls
[root@localhost test]# ls /test
[root@localhost test]#
bin-binary
usr-user
sbin-super binary
-a all
-l long
drwxr-xr-x
文件类型:
d-目录directory
- 二进制文件
l 软链接文件link
权限分类:r-read读权限、w-write写、x-execute执行
rwx r-x r-x
用户分类:
(1)第一类用户:所有者u
user
onwer
(2)第二类用户:所属组g
group
(3)第三类用户:其他人o
others
drwxr-xr-x 2 root root 4096 12-01 20:52 bin
2-硬链接数 所有者 所属组 文件大小 创建时间或最后修改时间 目录或者文件的名
称
数据块 block 512字节
cd change directory 切换目录
pwd print working directory 显示但其那所在的工作目录
touch 创建空文件
mkdir make directory 创建目录
cp copy 复制文件或目录(复制目录cp -R)
cp /etc/inittab /etc/services /test 拷贝inittab、services文件到test目录下
[root@localhost test]# ls
inittab services testfile
[root@localhost test]# cp -R /etc /test 复制目录
ctrl+c 终止命令
mv move 移动文件、更名(剪切)
rm remove 删除文件
rm -f 文件名 接删除文件 不会提示是否删除
rm -r 删除目录
rmdir 删除空目录
rm -rf 文件目录 (这个目录的所有文件都删除)不用询问