天天看點

Linux unit14

14.linux中裝置的通路

1.裝置識别

/dev/xdxn##硬碟裝置/dev/sda1

/dev/cdrom##光驅

/dev/mapper/*##虛拟裝置

2.裝置的使用與發現

<a href="https://s1.51cto.com/wyfs02/M01/91/DF/wKiom1j4x4SSYr1-AAEh6pZLRfU860.png-wh_500x0-wm_3-wmp_4-s_705537159.png" target="_blank"></a>

cat /proc/partitions##系統能夠識别的裝置

<a href="https://s3.51cto.com/wyfs02/M01/91/DE/wKioL1j4x6qj6XV2AACBhYkkmNI564.png-wh_500x0-wm_3-wmp_4-s_158059473.png" target="_blank"></a>

blkid##系統能夠挂載使用的裝置id

<a href="https://s3.51cto.com/wyfs02/M00/91/DF/wKiom1j4x7nxY6FcAAFn8C8ca8w609.png-wh_500x0-wm_3-wmp_4-s_1238278947.png" target="_blank"></a>

df##檢視裝置被系統使用的情況

裝置的挂載

mount 裝置挂載點

mount /dev/sdb1/mnt#把系統中第二塊硬碟的第一個分區挂載到/mnt目錄上

解除安裝裝置

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掃描裝置

看此程序在哪裡被占用 

軟硬連結

ls -i##檢視檔案節點号

ln -s /file /file1##軟連結

ln /file /file1##硬連結

<a href="https://s4.51cto.com/wyfs02/M02/91/DF/wKiom1j4yBvwe890AAEAixoyqt8056.png-wh_500x0-wm_3-wmp_4-s_3314466670.png" target="_blank"></a>

<a href="https://s4.51cto.com/wyfs02/M02/91/DE/wKioL1j4yByiFDBRAAD0O4hBM3o372.png-wh_500x0-wm_3-wmp_4-s_353214627.png" target="_blank"></a>

檔案查找

1.locate filename##在檔案資料庫中搜尋filename資訊,updatedb更新檔案資料庫

2.find

find 查找位置-條件條件值 -exec 動作 {} \;

-name   -not條件   -user   -group   -size

-perm   --maxdepth  --mindepth -a  -o  -typef檔案

 d目錄

c字元裝置

b塊裝置

s套節字

l連結

<a href="https://s1.51cto.com/wyfs02/M00/91/DE/wKioL1j4yOHCmHJkAABLzGHVVTw717.png-wh_500x0-wm_3-wmp_4-s_3569164265.png" target="_blank"></a>

find /mnt -user student

<a href="https://s4.51cto.com/wyfs02/M01/91/DE/wKioL1j4yb_BHMcGAAApEhnulKM664.png-wh_500x0-wm_3-wmp_4-s_1694154827.png" target="_blank"></a>

find /mnt -group linux

<a href="https://s3.51cto.com/wyfs02/M00/91/DE/wKioL1j4yRiQS3Z7AADVUywPm54799.png-wh_500x0-wm_3-wmp_4-s_1358264083.png" target="_blank"></a>

<a href="https://s5.51cto.com/wyfs02/M01/91/DF/wKiom1j4yRmCjplnAAApEhnulKM129.png-wh_500x0-wm_3-wmp_4-s_328368661.png" target="_blank"></a>

find /mnt -user student -a -group linux

find /mnt -user student -o -group linux

<a href="https://s2.51cto.com/wyfs02/M01/91/DE/wKioL1j4yWPgTrvHAADS5iDRkaY157.png-wh_500x0-wm_3-wmp_4-s_3638751002.png" target="_blank"></a>

find /mnt -user student -a -not -group linux

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

find /mnt -size -10k

find /mnt -size +10k

本文轉自AELY木部落格51CTO部落格,原文連結http://blog.51cto.com/12768057/1917970如需轉載請自行聯系原作者

AELY木