最新linux运维上海实战面试题

内容发布更新时间 : 2024/6/28 5:33:59星期一 下面是文章的全部内容请认真阅读。

精品文档

1、显示/test目录下的所有目录

答:豪鹫这里提供4种方法: ls -d */

find . -type d -maxdepth 1 (如果不加-maxdepth 参数,将会列出无穷多的子目录。) ls -F | grep '/$'

ls -l | grep '^d'|awk '{print $9}'

2、将文件/etc/a 下中除了 b文件外的所有文件压缩打包放到/home/a下,名字为a.gz

答: tar --exclude /etc/a/b -zPcvf /home/a/a.gz /etc/a (不加P选项会提示:『tar: Removing leading `/' from member names』) 验证:

[root@haojiu a]# tar tPvf /home/a/a.gz (忽略掉b文件) drwxr-xr-x root/root 0 2015-08-21 10:15 /etc/a/ -rw-r--r-- root/root 0 2015-08-21 10:15 /etc/a/d -rw-r--r-- root/root 0 2015-08-21 10:15 /etc/a/f -rw-r--r-- root/root 0 2015-08-21 10:15 /etc/a/c -rw-r--r-- root/root 0 2015-08-21 10:15 /etc/a/e

3、给一个脚本赋予执行权限的命令及选项 答: chmod +x a.sh 精品文档

联系客服:779662525#qq.com(#替换为@) 苏ICP备20003344号-4 ceshi