df ###查看已经使用了的空间ios
blkid ###显示全部可用设备的id信息数据库
du -sh /mnt/ ###查看设备的使用状况vim
fuser -vm /dev/sdb1 ###bash
[kiosk@foundation59 Desktop]$ fuser -vm /dev/sdb1ide
[kiosk@foundation59 Desktop]$
spa
[root@foundation14 ~]# updatedb ###更新数据库orm
[root@foundation14 ~]# locate westos ###查找westos文件,locate查找不许确,locate只在数据库里面查找,因此要更新数据路库server
[root@foundation14 ~]# touch /boot/westosxml
[root@foundation14 ~]# locate westosrpc
[root@foundation14 ~]# updatedb
[root@foundation14 ~]# locate westos
/boot/westos
[root@foundation14 ~]# rm -fr /boot/westos
[root@foundation14 ~]# locate westos
/boot/westos
[root@foundation14 ~]# ll /boot/westos
ls: cannot access /boot/westos: No such file or directory
[root@foundation14 ~]# cat /boot/westos
cat: /boot/westos: No such file or directory
[root@foundation14 ~]# updatedb
[root@foundation14 ~]# cat /boot/westos
cat: /boot/westos: No such file or directory
[root@foundation14 ~]# locate westos
[root@foundation14 ~]#
[root@desktop14 Desktop]# cd /mnt
[root@desktop14 mnt]# ls
[root@desktop14 mnt]# touch file{1..5}
[root@desktop14 mnt]# ll
total 0
-rw-r--r--. 1 root root 0 Oct 12 21:53 file1
-rw-r--r--. 1 root root 0 Oct 12 21:53 file2
-rw-r--r--. 1 root root 0 Oct 12 21:53 file3
-rw-r--r--. 1 root root 0 Oct 12 21:53 file4
-rw-r--r--. 1 root root 0 Oct 12 21:53 file5
[root@desktop14 mnt]# grep bash /etc/passwd ###查看用户本机全部用户信息
root:x:0:0:root:/root:/bin/bash
student:x:1000:1000:Student User:/home/student:/bin/bash
[root@desktop14 mnt]# useradd westos
[root@desktop14 mnt]# useradd lee
[root@desktop14 mnt]# chown westos file1 ###更改文件file1所属用户为westsos
[root@desktop14 mnt]# chown lee file2
[root@desktop14 mnt]# chown westos.lee file3 ##3更改文件file3所属用户为westos所属组为lee
[root@desktop14 mnt]# chown lee.lee file4
[root@desktop14 mnt]# ll
total 0
-rw-r--r--. 1 westos root 0 Oct 12 21:53 file1
-rw-r--r--. 1 lee root 0 Oct 12 21:53 file2
-rw-r--r--. 1 westos lee 0 Oct 12 21:53 file3
-rw-r--r--. 1 lee lee 0 Oct 12 21:53 file4
-rw-r--r--. 1 root root 0 Oct 12 21:53 file5
[root@desktop14 mnt]# find /mnt/ -user westos ###查找属于用户westos的文件
/mnt/file1
/mnt/file3
[root@desktop14 mnt]# find /mnt/ -group root ###查找属于组root的文件
/mnt/
/mnt/file1
/mnt/file2
/mnt/file5
[root@desktop14 mnt]# ll -d /mnt/ ###查看目录信息
drwxr-xr-x. 2 root root 66 Oct 12 21:53 /mnt/
[root@desktop14 mnt]# find /mnt/ -group lee -a -user westos ###查找属于组lee而且属于用户westos的
/mnt/file3
[root@desktop14 mnt]# find /mnt/ -not -group lee -a -not -user westos ###查找再也不组lee而且不属于用古westos的
/mnt/
/mnt/file2
/mnt/file5
###############################
[root@desktop14 mnt]# dd if=/dev/zero of=/mnt/file1 bs=1024 count=10
10+0 records in
10+0 records out
10240 bytes (10 kB) copied, 0.000149041 s, 68.7 MB/s
[root@desktop14 mnt]# dd if=/dev/zero of=/mnt/file2 bs=1024 count=20 ###指的是一个空的设备input,output
20+0 records in
20+0 records out
20480 bytes (20 kB) copied, 0.000150441 s, 136 MB/s
[root@desktop14 mnt]# dd if=/dev/zero of=/mnt/file3 bs=1024 count=30
30+0 records in
30+0 records out
30720 bytes (31 kB) copied, 0.000167358 s, 184 MB/s
[root@desktop14 mnt]# ll
total 64
-rw-r--r--. 1 root root 10240 Oct 12 22:08 file1
-rw-r--r--. 1 root root 20480 Oct 12 22:08 file2
-rw-r--r--. 1 root root 30720 Oct 12 22:09 file3
[root@desktop14 mnt]# find /mnt/ -size 20k ###查找文件大小为20k的
/mnt/file2
[root@desktop14 mnt]# find /mnt/ -size -20k ###查找文件小于20k的
/mnt/
/mnt/file1
[root@desktop14 mnt]# find /mnt/ -size +20k ###查找文件大于20k的
/mnt/file3
[root@desktop14 mnt]# find /mnt/ -size -20k -a -type f ###查找文件小于20k
/mnt/file1
[root@desktop14 mnt]# find /mnt/ -size -20k -a -type d ###查找目录小于20k
/mnt/
[root@desktop14 mnt]#
##############################
[root@desktop14 mnt]# chmod 000 /mnt/* ###更改/mnt/下全部文件的权限为0
[root@desktop14 mnt]# ll
total 64
----------. 1 root root 10240 Oct 12 22:08 file1
----------. 1 root root 20480 Oct 12 22:08 file2
----------. 1 root root 30720 Oct 12 22:09 file3
[root@desktop14 mnt]# chmod 444 file1 ###更改文件file1的权限
[root@desktop14 mnt]# chmod 404 file2
[root@desktop14 mnt]# ll
total 64
-r--r--r--. 1 root root 10240 Oct 12 22:08 file1
-r-----r--. 1 root root 20480 Oct 12 22:08 file2
----------. 1 root root 30720 Oct 12 22:09 file3
[root@desktop14 mnt]# find /mnt -perm 444 ###查找文件权限等于444的文件,permission
/mnt/file1
[root@desktop14 mnt]# find /mnt -perm -444 ###查找权限大于和等于444文件的
/mnt
/mnt/file1
[root@desktop14 mnt]# find /mnt -perm /444
/mnt
/mnt/file1
/mnt/file2
[root@desktop14 mnt]# find /mnt -perm /755 ###斜杠后面跟的数字越大,找到知足条件的文件会越多,觉得他是或的关系,只要7个条件中有一个知足就能够
/mnt
/mnt/file1
/mnt/file2
[root@desktop14 mnt]# urwx grx orx^C
####################################################
perm 444 ###文件权限必须是rrr
perm -444 ###文件每一位都要含有r权限
perm /444 ###文件任意一位含有r权限
-maxdepth 数字 ###最深目录层
-mindepth 数字 ###最浅目录层
-exec 命令 {} \ ###对查找出的结果作相应的处理
[root@desktop14 mnt]# find /etc/ -maxdepth 2 -mindepth 2 -name ^C
[root@desktop14 mnt]# find /etc/ -name passwd ###查找文件名为passwd的文件
/etc/passwd
/etc/pam.d/passwd
[root@desktop14 mnt]# find /etc/ -maxdepth 1 -name passwd ###查找目录深度为1的文件名为passwd的文件
/etc/passwd
[root@desktop14 mnt]# find /etc/ -maxdepth 2 -name passwd ###查找目录深度为2之内(包括深度为1的)的文件名为passwd的文件
/etc/passwd
/etc/pam.d/passwd
[root@desktop14 mnt]# find /etc/ -maxdepth 2 -mindepth 2 -name passwd ###查找最大深度是2最小深度也是2的文件名为passwd的文件
/etc/pam.d/passwd
[root@desktop14 mnt]# find /etc/ -maxdepth 2 -mindepth 2 -name passwd -exec cp {} /mnt \; ###查找最大深度是2最小深度也是2的文件名是passwd的文件,而且把它复制到/mnt目录下
[root@desktop14 mnt]# ls ###查看刚才复制过来的文件
file1 file2 file3 passwd
[root@desktop14 mnt]# find /mnt/ -perm -444 -exec rm -fr {} \; ###查找文件权限是444而且删除全部
find: ‘/mnt/’: No such file or directory
[root@desktop14 mnt]#
[root@desktop14 mnt]# ls
[root@desktop14 mnt]#
软链接就是快捷方式,创建软连接的目的是为了节省设备存储
硬连接就是把文件从新复制一次,只有文件的内容没有文件的属性
[root@desktop14 mnt]# touch file
[root@desktop14 mnt]# ln -s /mnt/file /mnt/westos ###soft指的软连接
[root@desktop14 mnt]# ll
total 0
drwxr-xr-x. 2 root root 6 Oct 12 23:06 backup ###其中的2是文件被记录的次数
-rw-r--r--. 1 root root 0 Oct 12 23:15 file
lrwxrwxrwx. 1 root root 9 Oct 12 23:15 westos -> /mnt/file
[root@desktop14 mnt]# rm -fr file
[root@desktop14 mnt]# cat /mnt/westos ###删掉文件以后,软连接也不可用
cat: /mnt/westos: No such file or directory
[root@desktop14 mnt]# rm -fr *
[root@desktop14 mnt]# touch file
[root@desktop14 mnt]# ln /mnt/file /mnt/westos ###建立硬连接,
[root@desktop14 mnt]# ll
total 0
-rw-r--r--. 2 root root 0 Oct 12 23:17 file
-rw-r--r--. 2 root root 0 Oct 12 23:17 westos
[root@desktop14 mnt]# ln /mnt/file /mnt/westos1
[root@desktop14 mnt]# ll
total 0
-rw-r--r--. 3 root root 0 Oct 12 23:17 file
-rw-r--r--. 3 root root 0 Oct 12 23:17 westos
-rw-r--r--. 3 root root 0 Oct 12 23:17 westos1
[root@desktop14 mnt]# rm -fr westos1
[root@desktop14 mnt]# ll
total 0
-rw-r--r--. 2 root root 0 Oct 12 23:17 file ###删除一次,文件的被记录的次数减小一次
-rw-r--r--. 2 root root 0 Oct 12 23:17 westos
[root@desktop14 mnt]# rm -fr westos
[root@desktop14 mnt]# ll
total 0
-rw-r--r--. 1 root root 0 Oct 12 23:17 file
[root@desktop14 mnt]# rm -fr file
[root@desktop14 mnt]# ll
total 0
[root@desktop14 mnt]# ls -li * ###查看节点信息
virt-manager ###安装虚拟机
ls -i ###查看设备的节点号
[root@foundation59 mnt]# virt-manager ###弹出虚拟机管理界面
[root@foundation59 mnt]# virt-viewer desktop ###当即弹出desktop虚拟机界面
[root@foundation14 ~]# virt-manager test11
[root@foundation14 ~]# virt-viewer test11 ###查看虚拟机
(virt-viewer:15729): GSpice-WARNING **: PulseAudio context failed Connection refused
(virt-viewer:15729): GSpice-WARNING **: pa_context_connect() failed: Connection refused
(virt-viewer:15729): GSpice-WARNING **: Warning no automount-inhibiting implementation available
^C
[root@foundation14 ~]#
[root@foundation14 ~]# virsh list ###列出全部虚拟机信息
Id Name State
----------------------------------------------------
2 desktop paused
3 server paused
8 test11 running
[root@foundation14 ~]# virsh list --all
Id Name State
----------------------------------------------------
2 desktop paused
3 server paused
8 test11 running
[root@foundation14 ~]# virsh destroy test11 ###当即关闭虚拟机
Domain test11 destroyed
[root@foundation14 ~]# virsh start test11 ###开启虚拟机
[root@foundation14 ~]# virsh shutdown test11 ###关闭虚拟机
Domain test11 started
[root@foundation14 ~]# cd /var/lib/libvirt/p_w_picpaths ###进入虚拟机文件存放目录
[root@foundation14 p_w_picpaths]# ls ###查看全部可用源镜像
rh124-desktop-vda.ovl rh124-desktop.xml rh124-server-vdb.qcow2
rh124-desktop-vda.qcow2 rh124-server-vda.ovl rh124-server.xml
rh124-desktop-vdb.ovl rh124-server-vda.qcow2 rhel7.0.qcow2
rh124-desktop-vdb.qcow2 rh124-server-vdb.ovl
[root@foundation14 p_w_picpaths]# qemu-img create -f qcow2 -b rhel7.0.qcow2 test1.qcow2 ###快照虚拟机,新快照名为test1.qcow2
Formatting 'test1.qcow2', fmt=qcow2 size=9663676416 backing_file='rhel7.0.qcow2' encryption=off cluster_size=65536 lazy_refcounts=off
[root@foundation14 p_w_picpaths]# ls ###查看新建的快照
rh124-desktop-vda.ovl rh124-desktop.xml rh124-server-vdb.qcow2
rh124-desktop-vda.qcow2 rh124-server-vda.ovl rh124-server.xml
rh124-desktop-vdb.ovl rh124-server-vda.qcow2 rhel7.0.qcow2
rh124-desktop-vdb.qcow2 rh124-server-vdb.ovl test1.qcow2
[root@foundation14 p_w_picpaths]# du -sh test1.qcow2 ###查看快照的大小信息
196Ktest1.qcow2
####################################################################
而后新建虚拟机,选择已有镜像
交互式登录就是你能够和系统进行对话,系统会有反馈
vim /etc/chrony.conf ###设置时间进行同步
[root@foundation59 ~]# find / -group mail ###
find: ‘/proc/4303/task/4303/fd/6’: No such file or directory
find: ‘/proc/4303/task/4303/fdinfo/6’: No such file or directory
find: ‘/proc/4303/fd/6’: No such file or directory
find: ‘/proc/4303/fdinfo/6’: No such file or directory
find: ‘/run/user/1000/gvfs’: Permission denied
/var/spool/mail
/var/spool/mail/rpc
/var/spool/mail/kiosk
^C
[root@foundation59 ~]#
[root@foundation59 ~]# find / -group mail -exec cp -rp {} /mnt/backup \; ###找出用户组mail 拥有的文件,而且将它们放到/mnt/backup 目录中
find: ‘/proc/4335/task/4335/fd/6’: No such file or directory
find: ‘/proc/4335/task/4335/fdinfo/6’: No such file or directory
find: ‘/proc/4335/fd/6’: No such file or directory
find: ‘/proc/4335/fdinfo/6’: No such file or directory
find: ‘/run/user/1000/gvfs’: Permission denied
^C