Sequence 1: Using find

Scenario: Log in as user student. Devise and execute a find command that produces
the result described in each of the following problems, then write down the
command in the space provided.

You may need to refer to the man page for find. Remember that you can search
man pages with /string.

You will encounter a number of Permission denied messages when
find attempts to recurse into directories to which you do not have read access -
do not be concerned about these messages. Better yet, you can suppress these
error messages by appending your find command with 2> /dev/null.

Instructions:

1. Produce a listing of everything under /var/lib owned by user rpm.

find /var/lib -user rpm 2> /dev/null

2. Produce a listing of everything under /var owned by user root and group mail.

find /var -user root -group mail 2> /dev/null

3. Produce an ls -l style listing of everything on the system not owned by users root, bin or
student

This will take a long time, so run the command in one terminal and do the next problem in
another terminal while it runs.

find / -not -user root -not -user bin -not -user student -ls 2> /dev/null
or
find / ! -user root ! -user bin ! -user student -ls 2>/dev/null

4. Produce an ls -l style listing of everything under /usr/bin with size greater than 50
kilobytes

find /usr/bin -size +50k -ls 2> /dev/null

5. Execute the file command on everything under /etc/mail

find /etc/mail -exec file {} \; 2> /dev/null

6. Produce an ls -l style listing of all symbolic links under /etc

Hint: man find and search for an option that searches for files by type

find /etc/ -type l -ls 2> /dev/null

7. Produce an ls -l style listing of all "regular" files under /tmp that are owned by user
student, and whose modification time is greater than 120 minutes ago.

Hint: man find and search for an option that searches by modification time in minutes

find /tmp -user student -mmin +120 -type f -ls 2> /dev/null

8. Modify the command above to find all "regular" files under /tmp that are owned by user
student, and whose modification time is greater than 120 minutes ago, and have find
prompt you interactively whether or not to remove each one. Because you are using the
interactive option, do not throw out error messages; that is, do not end your command with
2> /dev/null. Decline to remove all files when prompted.

find /tmp -user student -mmin +120 -type f -ok rm {} \;

Note: The standard error is not redirected in answer number 9 because that would prevent
the questions being asked by -ok from being displayed.

9. Produce a listing of all files under /bin and /usr/bin that have the SetUID bit set.

find /bin /usr/bin -perm -4000 2> /dev/null
or
find /bin /usr/bin -perm -u+s 2> /dev/null

RH033读书笔记(12)-Lab 13 Finding and Processing Files的更多相关文章

  1. RH033读书笔记(11)-Lab 12 Configuring the bash Shell

    Sequence 1: Configuring the bash Shell Deliverable: A system with new aliases that clear the screen, ...

  2. RH033读书笔记(5)-Lab 6 Exploring the Bash Shell

    Lab 6 Exploring the Bash Shell Sequence 1: Directory and file organization 1. Log in as user student ...

  3. RH033读书笔记(8)-Lab 9 Using vim

    Lab 9 Using vim Sequence 1: Navigating with vim 1. Log in as user student 2. [student@stationX ~]$ c ...

  4. RH033读书笔记(16)-Lab 17 Installation and Administration Tools

    Lab 17 Installation and Administration Tools Goal: Become familiar with system configuration tools a ...

  5. RH033读书笔记(10)-Lab 11 Process Control

    Lab 11 Process Control Sequence 1: Job Control 1. [student@stationX ~]$ su - 2. Begin some jobs in t ...

  6. RH033读书笔记(15)-Lab 16 The Linux Filesystem

    Lab 16 The Linux Filesystem Goal: Develop a better understanding of Linux filesystem essentials incl ...

  7. RH033读书笔记(2)-Lab 3 Getting Help with Commands

    Lab 3 Getting Help with Commands Sequence 1: Using the Help Tools 1. man -f keyword whatis keyword l ...

  8. RH033读书笔记(4)-Lab 5 File Permissions

    Lab 5 File Permissions Sequence 1: Determining File Permissions 1. What is the symbolic representati ...

  9. RH033读书笔记(3)-Lab 4 Browsing the Filesystem

    Lab 4 Browsing the Filesystem Sequence 1: Directory and File Organization 1. Log in as user student ...

随机推荐

  1. [Linux]Centos git报错fatal: HTTP request failed

    在使用git pull.git push.git clone会报类似例如以下的错误: error: The requested URL returned error: 401 Unauthorized ...

  2. 基于Java的开源CMS系统选择(转)

    CMS概述 对于网站CMS系统而言,基于PHP的是主流,如Drupal/Joomla在各个主流虚拟机提供商上都是标准配置,也被广泛使用. 但如果你拥有Java团队,或者项目目标是想建立一个企业网使用的 ...

  3. java api例子网站

    http://www.programcreek.com/java-api-examples/ http://www.apihome.cn/api/list/ http://www.docjar.com ...

  4. ocx控件手动修改clsid的方法

    替换掉工程的两个地方:IDL文件和CTRL文件. IMPLEMENT_OLECREATE_EX(CMultiwndCtrl, "MULTIWND.MultiwndCtrl.1", ...

  5. Windows Phone开发(47):轻松调用Web Service

    原文:Windows Phone开发(47):轻松调用Web Service 众所周知(除了没用过VS的),在VS里面调用Web Service是一件很愉快的事情,不解释,相信很多朋友在以前的项目中肯 ...

  6. Windows Phone开发(43):推送通知第一集——Toast推送

    原文:Windows Phone开发(43):推送通知第一集--Toast推送 好像有好几天没更新了,抱歉抱歉,最近"光荣"地失业,先是忙于寻找新去处,唉,暂时没有下文.而后又有一 ...

  7. poj2348(博弈)

    poj2348 给定两个数a,b,大的数能减少小的数的倍数,不能是的数小于0,谁先使得数等于0,谁就赢了 有三种情况 ① a % b ==0  这个状态是必胜的 ② a - b < b  这个状 ...

  8. SQL注入的原理解说,挺好!

    原文地址:http://www.cnblogs.com/rush/archive/2011/12/31/2309203.html 1.1.1 总结 前几天,国内最大的程序猿社区CSDN网站的用户数据库 ...

  9. web:转盘抽奖

    移动web:转盘抽奖(幸运大转盘)   为了获取客户.回馈客户,平台一般会推出抽奖活动类的营销页.因此web页面中,有各式各样的抽奖效果. 格子式(九宫格),背景滚动式(数字/文字/图案),旋转式(转 ...

  10. Centos memcached的php拓展 管理界面

    确定已安装apache 一.安装php5 1.安装libxml2 tar zxvf libxml2-.tar.gz cd libxml2- ./configure --prefix=/usr/loca ...