1
2
3
4
5
|
[root@localhost ~] # ls -ld /home drwxr-xr-x. 4 root root 4096 9月 22 10:41 /home [root@localhost ~] # ls -d /home /home [root@localhost ~] # |
1
2
3
4
5
6
7
|
[root@localhost ~] # ls -h /home justin lost+found [root@localhost ~] # ls -lh /home 总用量 20K drwx------. 27 justin justin 4.0K 9月 22 13:19 justin drwx------. 2 root root 16K 9月 18 15:30 lost+found [root@localhost ~] # |
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
[root@localhost ~] # ls -lR /home /home : 总用量 20 drwx------. 27 justin justin 4096 9月 22 13:19 justin drwx------. 2 root root 16384 9月 18 15:30 lost+found /home/justin : 总用量 32 drwxr-xr-x. 2 justin justin 4096 9月 22 10:49 公共的 drwxr-xr-x. 2 justin justin 4096 9月 22 10:49 模板 drwxr-xr-x. 2 justin justin 4096 9月 22 10:49 视频 drwxr-xr-x. 2 justin justin 4096 9月 22 10:49 图片 drwxr-xr-x. 2 justin justin 4096 9月 22 10:49 文档 drwxr-xr-x. 2 justin justin 4096 9月 22 10:49 下载 drwxr-xr-x. 2 justin justin 4096 9月 22 10:49 音乐 drwxr-xr-x. 2 justin justin 4096 9月 22 10:49 桌面 /home/justin/ 公共的: 总用量 0 /home/justin/ 模板: 总用量 0 /home/justin/ 视频: 总用量 0 /home/justin/ 图片: 总用量 0 /home/justin/ 文档: 总用量 0 /home/justin/ 下载: 总用量 0 /home/justin/ 音乐: 总用量 0 /home/justin/ 桌面: 总用量 0 /home/lost +found: 总用量 0 [root@localhost ~] # |
1
2
3
4
5
6
7
8
9
10
11
|
[root@localhost ~] # ls -l /home 总用量 20 drwx------. 27 justin justin 4096 9月 22 13:19 justin drwx------. 2 root root 16384 9月 18 15:30 lost+found -rw-r--r--. 1 root root 0 9月 22 15:21 t [root@localhost ~] # ls -lt /home 总用量 20 -rw-r--r--. 1 root root 0 9月 22 15:21 t drwx------. 27 justin justin 4096 9月 22 13:19 justin drwx------. 2 root root 16384 9月 18 15:30 lost+found [root@localhost ~] # |
1
2
3
4
5
6
7
8
9
10
11
12
|
gssapi_mech.conf popt.d xml gtk-2.0 portreserve yp.conf hal postfix yum host.conf ppp yum.conf hosts prelink.cache yum.repos.d hosts.allow prelink.conf hosts.deny prelink.conf.d [root@localhost etc] # ll -d /etc/po*.d drwxr-xr-x. 2 root root 4096 1月 11 2010 /etc/popt .d [root@localhost etc] # ll -d /etc/po?.d ls : 无法访问 /etc/po ?.d: 没有那个文件或目录 [root@localhost etc] # |
1
2
3
4
5
|
[root@localhost src] # du -h nagios-3.5.0.tar.gz 1.8M nagios-3.5.0. tar .gz [root@localhost src] # du nagios-3.5.0.tar.gz 1748 nagios-3.5.0. tar .gz [root@localhost src] # |
-a---显示全部目录和其次目录下的每个档案所占的磁盘空间
1
2
3
|
[root@localhost local ] # du -b src/nagios-3.5.0.tar.gz 1789376 src /nagios-3 .5.0. tar .gz [root@localhost local ] # |
1
2
3
|
[root@localhost local ] # du -sh src/ 41M src/ [root@localhost local ] # |
1
2
3
4
5
6
7
8
|
[root@localhost ~] # df -Th 文件系统 类型 容量 已用 可用 已用%% 挂载点 /dev/sda2ext4 9.9G 2.6G 6.9G 28% / tmpfs tmpfs 504M 112K 504M 1% /dev/shm /dev/sda1ext4 194M 27M 158M 15% /boot /dev/sda5ext4 7.7G 147M 7.2G 2% /home /dev/sr0iso9660 2.9G 2.9G 0 100% /media/RHEL_6 .3 i386 Disc 1 [root@localhost ~] # |
1
2
3
4
5
6
|
[root@localhost home] # file justin/ justin/: directory [root@localhost home] # file justin1 justin1: empty [root@localhost ~] # file install.log install .log: UTF-8 Unicode text |
1
|
[root@localhost log] # cat /var/log/messages |
1
2
3
4
5
6
7
|
[root@localhost log] # more -5s /var/log/messages Sep 22 10:36:06 localhost kernel: imklog 5.8.10, log source = /proc/kmsg started. Sep 22 10:36:06 localhost rsyslogd: [origin software= "rsyslogd" swVersion= "5.8.10" x-pid = "1323" x-info= "http://www.rsyslog.com" ] start Sep 22 10:36:06 localhost kernel: Initializing cgroup subsys cpuset Sep 22 10:36:06 localhost kernel: Initializing cgroup subsys cpu --More--(0%) |
1
2
3
4
5
6
7
|
[root@localhost ~] # head -5 /etc/passwd root:x:0:0:root: /root : /bin/bash bin:x:1:1:bin: /bin : /sbin/nologin daemon:x:2:2:daemon: /sbin : /sbin/nologin adm:x:3:4:adm: /var/adm : /sbin/nologin lp:x:4:7:lp: /var/spool/lpd : /sbin/nologin [root@localhost ~] # |
1
2
3
4
5
6
7
|
[root@localhost ~] # tail -5 /etc/passwd nfsnobody:x:65534:65534:Anonymous NFS User: /var/lib/nfs : /sbin/nologin abrt:x:173:173:: /etc/abrt : /sbin/nologin sshd:x:74:74:Privilege-separated SSH: /var/empty/sshd : /sbin/nologin tcpdump:x:72:72::/: /sbin/nologin justin:x:500:500:justin_peng: /home/justin : /bin/bash [root@localhost ~] # |
说明:tail命令用法与head命令类似
1
2
3
4
|
[root@localhost home] # touch file1 file2 [root@localhost home] # ls file1 file2 justin lost+found t [root@localhost home] # |
1
2
3
4
5
6
7
|
[root@localhost home] # ls justin lost+found t [root@localhost home] # mkdir dir1 [root@localhost home] # mkdir dir2/dir mkdir : 无法创建目录 "dir2/dir" : 没有那个文件或目录 [root@localhost home] # mkdir -p dir2/dir [root@localhost home] # |
1
2
3
4
5
6
7
8
|
[root@localhost home] # ls justin lost+found t [root@localhost home] # mkdir -p {dir1,dir2/{dir3,dir4}} [root@localhost home] # ls dir1 dir2 justin lost+found t [root@localhost home] # ls dir2 dir3 dir4 [root@localhost home] # |
1
2
3
4
5
6
7
8
9
10
|
[root@localhost home] # mkdir -p {dir1,dir2/dir3} [root@localhost home] # ls dir1 dir2 justin lost+found t [root@localhost home] # rmdir dir1 [root@localhost home] # rmdir dir2 rmdir : 删除 "dir2" 失败: 目录非空 [root@localhost home] # rmdir -p dir2/dir3/ [root@localhost home] # ls justin lost+found t [root@localhost home] # |
1
2
3
4
5
6
|
[root@localhost home] # mkdir -p dir1/dir2 [root@localhost home] # rm -r dir1/ rm :是否进入目录 "dir1" ? y rm :是否删除目录 "dir1/dir2" ?y rm :是否删除目录 "dir1" ?y [root@localhost home] # |