14 設備掛載 文件查找.

#

14.linux中設備的訪問

#

1.設備訪問

1.設備識別
/dev/xdxn ##硬盤設備/dev/sda1
/dev/cdrom ##光驅
/dev/mapper/* ##虛擬設備

2.設備的使用
fdisk -l ##查看真實存在的設備
cat /proc/partitions ##系統能夠識別的設備
blkid ##系統能夠掛載使用的設備id
df ##查看設備被系統使用的情況

1.設備的掛載
mount 設備 掛載點
mount /dev/sdb1 /mnt #把系統中第二塊硬盤的第一個分區掛載到/mnt目錄上

2.卸載設備
umout 設備|掛載點

如出現以下情況:
[root@foundation0 ~]# umount /dev/sdb1
umount: /home/kiosk/Desktop/photo: target is busy.
(In some cases useful info about processes that use
the device is found by lsof(8) or fuser(1))
解決:
fuser -kvm 設備|掛載點 -k kill ,-v顯示詳細信息,-m掃描設備

2.軟硬鏈接

ls -i ##查看文件節點號
ln -s /file /file1 ##軟鏈接
ln /file /file1 ##硬鏈接

3.文件查找

1.locate filename ##在文件數據庫中搜索filename信息,updatedb更新文件數據庫
2.find

find 查找位置 -條件 條件值 -exec 動作 {} \;
-name
-not 條件
-user
-group
-size
-perm
–maxdepth
–mindepth
-a
-o
-type f 文件
d 目錄
c 字符設備
b 塊設備
s 套節字
l 鏈接

find /mnt -user student
find /mnt -group linux
find /mnt -user student -a -group linux a 表示 和
find /mnt -user student -o -group linux o 表示 或者
find /mnt -user student -a -group linux
find /mnt -user student
find /mnt -user student -a -not -group linux -not 表示 “不是”

dd if=/dev/zero of=/mnt/file1 bs=1024 count=10
dd if=/dev/zero of=/mnt/file2 bs=1024 count=20
dd if=/dev/zero of=/mnt/file3 bs=1024 count=30

find /mnt -size 10k 查找等於10k的
find /mnt -size -10k 查找小於10k的
find /mnt -size +10k 查找大於10k的

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章