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. storm-编程入门

    一 编程接口                                           watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvemhhbm ...

  2. HDU 4028 The time of a day STL 模拟题

    暴力出奇迹.. #include<stdio.h> #include<iostream> #include<algorithm> #include<vecto ...

  3. 华为C8816电信版ROOT过程

    华为C8816电信版ROOT方法, 网上的方法都不太靠谱.. 昨天弄了好久, 最终搞定.. 整理了一下.. 实用到的就方便多了. <方法不再啰嗦, 都有说明> 1. 获取手机解锁passw ...

  4. HTML5: Screen Orientation API

    媒体的询问取决于智能手机和平板布局调整的方向一致网站.但有时候你被锁定在一个希腊网站特定方向.横向或纵向.此时,是本机格式可以指定保健应用. APP只显示在一个预设格式-独立于实际设备方向.通过使用H ...

  5. 怎样将android studio项目导入eclipse

    如今,越来越多的开源项目都是用android studio来开发的,所以源码都与eclipse有所不同. 以下是将android studio项目导入eclipse的一般步骤: 1. 先解压项目: 2 ...

  6. C#之异步编程

    1 异步编程的重要性 C#5.0最重要的改进是提供了更强大的异步编程,C#5.0仅增加两个关键字Async和Await,使用异步编程,方法调用是后台运行(通常在线程和任务的帮助下),并且不会阻塞调用线 ...

  7. hdu4857 逃生 bestcoder round1 A

    题目要求要求在满足约束条件的情况下,使小的序号尽力靠前. 坑点就在这里.小的序号尽量靠前并非代表字典序,它要求多种情况时,先使1靠前(可能1仅仅能在第2或第3位 那么就要使它在第2位),其次2,3. ...

  8. Html5 Device API详解

    三.四月曾学习过html5相关知识,并就html5 device api做过一次讲解 课程时长一个小时,预期达到level 200目标,即知道html5 device api是什么,且知道怎么实现 面 ...

  9. ecshop购物流程中去掉email邮箱

    首先打开includes\lib_order.php,在第1688行左右找到并删除 !empty($consignee['email']) && 接着打开js\shopping_flo ...

  10. Oracle SQL Lesson (7) - 使用子查询

    使用子查询简单子查询SELECT select_listFROM tableWHERE expr operator (SELECT select_list FROM table);子查询可以出现在se ...