Linux unit14

简介:

14.linux中设备的访问


1.设备识别

/dev/xdxn##硬盘设备/dev/sda1

/dev/cdrom##光驱

/dev/mapper/*##虚拟设备

wKiom1j4x23gE9q4AACf0mGTFd0593.png-wh_50 

2.设备的使用与发现

wKiom1j4x4SSYr1-AAEh6pZLRfU860.png-wh_50

cat /proc/partitions##系统能够识别的设备

wKioL1j4x6qj6XV2AACBhYkkmNI564.png-wh_50

blkid##系统能够挂载使用的设备id

wKiom1j4x7nxY6FcAAFn8C8ca8w609.png-wh_50

df##查看设备被系统使用的情况

 wKiom1j4x8WQ0ytlAACf0mGTFd0708.png-wh_50

设备的挂载

mount 设备挂载点

mount /dev/sdb1/mnt#把系统中第二块硬盘的第一个分区挂载到/mnt目录上

卸载设备

umout设备|挂载点

wKioL1j4x9vSJ-bDAAEbWGRgbAk934.png-wh_50 

如出现以下情况:

[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##硬链接

wKiom1j4yBvwe890AAEAixoyqt8056.png-wh_50

wKioL1j4yByiFDBRAAD0O4hBM3o372.png-wh_50

 

文件查找

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链接

wKioL1j4yOHCmHJkAABLzGHVVTw717.png-wh_50

find /mnt -user student

wKioL1j4yb_BHMcGAAApEhnulKM664.png-wh_50

find /mnt -group linux

wKioL1j4yRiQS3Z7AADVUywPm54799.png-wh_50

wKiom1j4yRmCjplnAAApEhnulKM129.png-wh_50


find /mnt -user student -a -group linux

find /mnt -user student -o -group linux

wKioL1j4yWPgTrvHAADS5iDRkaY157.png-wh_50

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

 wKiom1j4yO6x3-xRAAC7RO3cvOs754.png-wh_50

find /mnt -size 10k

find /mnt -size -10k

find /mnt -size +10k



本文转自 AELY木 51CTO博客,原文链接:http://blog.51cto.com/12768057/1917970,如需转载请自行联系原作者

相关文章
|
7月前
|
网络协议 Linux 网络安全
【Linux环境】centos7 Failed to start iptables.service: Unit not found 防火墙
【Linux环境】centos7 Failed to start iptables.service: Unit not found 防火墙
306 0
|
8月前
|
Linux
17.1.2 【Linux】systemd使用的unit分类
17.1.2 【Linux】systemd使用的unit分类
74 0
|
设计模式 监控 网络协议
关于Linux中通过 Systemd Path Unit 监听配置更新自动重启服务的一些笔记
在 stackoverflow.com 的Unix & Linux 社区 看到有小伙伴提出相关的问题。 这里整理分享给小伙伴,博文内容涉及: Systemd 的 Path Units常用命令手册学习 Path Units 的应用 通过httpd服务演示监听配置文件自动重启服务 食用方式:需要了解一点 Systemd 理解不足小伙伴帮忙指正
205 0
|
Linux 开发工具 Shell
|
网络安全
Linux_异常_03_Failed to restart iptables.service: Unit not found.
启动防火墙时出现: Failed to restart iptables.service: Unit not found.     解决方案: 1.https://stackoverflow.
7667 0
|
监控 Unix 测试技术
|
网络协议 Linux 开发工具
|
Web App开发 Linux 开发工具