zoukankan      html  css  js  c++  java
  • 3、文件管理-面试题

    试题内容


    自己写答案(错题标粗并倾斜)

    1、

    [root@centos7 b]# mv file1 ../../dic
    

    2、

    [root@centos7 b]# ln  -s /lib64/libc.so /usr/lib64/libc.so
    
    或者
    [root@centos7 b]# ln ../../lib64/libc.so.6 /usr/lib64/libc.so.64 -s 
    [root@centos7 b]# ll /usr/lib64/libc.so.64
    lrwxrwxrwx. 1 root root 21 8月   7 07:08 /usr/lib64/libc.so.64 -> ../../lib64/libc.so.6
    

    3、-p

    4、ln -s

    5、pwd

    6、

    [root@centos7 tmp]# mkdir dic
    

    7、cp -a; 将alias cp='cp -a'写入vim /etc/profile.d/env.sh

    8、/root

    9、-

    10、df -i查看下该分区的的inode节点是不是满了,如果满了,删掉一些无用的文件,或者放其它盘

    11、/root分区和/boot分区。swap

    12、mv

    13、-d

    14、su -

    15、4

    16、软链接和硬链接

    17、文件被程序占用

    18、rc.local启动加载文件,会执行里面的一些程序;message是CentOS系统的日志文件

    19、

    ***```bash
    [root@docker1 ~]# sed 's/test/good/g' /home/test/ct -i

    
    20、
    
    ```bash
    [root@centos7 tmp]# ls -hl
    总用量 1012M
    drwxr-xr-x. 3 root root   15 8月   7 07:04 b
    drwxr-xr-x. 2 root root    6 8月   7 07:10 dic
    -rw-r--r--. 1 root root 5.0K 8月   7 07:34 test1
    -rw-r--r--. 1 root root 500M 8月   7 07:35 test2
    

    21、

    [root@centos7 tmp]# df -h
    文件系统        容量  已用  可用 已用% 挂载点
    /dev/sda2       100G  5.7G   95G    6% /
    devtmpfs        974M     0  974M    0% /dev
    tmpfs           991M     0  991M    0% /dev/shm
    tmpfs           991M   11M  980M    2% /run
    tmpfs           991M     0  991M    0% /sys/fs/cgroup
    /dev/sda1      1014M  166M  849M   17% /boot
    /dev/sda3        50G  833M   50G    2% /data
    tmpfs           199M   40K  199M    1% /run/user/0
    /dev/sr0         11G   11G     0  100% /run/media/root/CentOS 7 x86_64
    

    22、df -h

    23、

    本质上:软链接是新的文件,硬链接是源文件的不同名字

    源文件:源文件删除后软链接将不可用,硬链接删除后,文件仍可用

    链接数:硬链接会增加文件的链接数,软链接不会

    inode节点号:硬链接节点号与源文件一样,软链接节点号与源文件一样

    跨分区:硬链接不可跨分区,软链接可以

    链接文件的大小:软链接很小,几个字节,硬链接和源文件一样

    相对路径法:硬链接相对于当前路径,软链接:使用时源文件路径要写为相对于链接文件的路径

    ***24、使用如下命令触发硬盘扫描,然后lsblk就可以看到了,就可以进行操作

    [root@centos7 ~]# echo '- - -' > /sys/class/scsihost/host2/scan 
    [root@centos7 ~]# echo '- - -' > /sys/class/scsihost/host1/scan 
    [root@centos7 ~]# echo '- - -' > /sys/class/scsihost/host0/scan
    ```*
    
    25、c
    
    26、a
    
    27、a
    
    28、d
    
    ***29、该文件可能被某程序占用,使用lsof | grep ‘文件名’看下哪个程序在使用,杀死或重启该程序***
    
    
    
    ---
    
    ### 参考答案:
    ![](https://s1.51cto.com/images/blog/201907/23/bc3c0397e053d84e49bd5e0bfa3fea52.png)
    ![](https://s1.51cto.com/images/blog/201907/23/4e9ad94a1aeecdb99046258f25077405.png)
    ![](https://s1.51cto.com/images/blog/201907/23/45447849a748c057c62e182398894c53.png)
    ![](https://s1.51cto.com/images/blog/201907/23/4eb247902f84483d05dd083d8cbccb19.png)
  • 相关阅读:
    【独家】K8S漏洞报告 | 近期bug fix解读
    idou老师教你学Istio 29:Envoy启动流程
    idou老师教你学Istio 28:istio-proxy check 的缓存
    idou老师教你学Istio :5分钟简析Istio异常检测
    idou老师教你学Istio 27:解读Mixer Report流程
    idou老师教你学Istio 26:如何使用Grafana进行可视化监控
    idou老师教你学Istio 25:如何用istio实现监控和日志采集
    idou老师教你学Istio 24:如何在Istio使用Prometheus进行监控
    idou老师教你学Istio 23 : 如何用 Istio 实现速率限制
    idou老师教你学Istio 22 : 如何用istio实现调用链跟踪
  • 原文地址:https://www.cnblogs.com/uscWIFI/p/11231088.html
Copyright © 2011-2022 走看看