Bash Shell programming Exercises

Source: Internet
Author: User
Tags rsyslog

Original file:

Find/etc-name passwd 2>&1 | Tee Ee.log

1. Cat-n The document contents of the E.log with the line number and enter E2.log in this document:

[Email protected] ~/t2scripts $ cat-n E.log |Tee E2.log1/etc/passwd2     3     4Find: '/etc/ntp/crypto': Permission denied     5Find: '/etc/audisp': Permission denied     6Find: '/etc/audit': Permission denied     7     8Find: '/etc/polkit-1/localauthority': Permission denied     9Find: '/etc/dhcp': Permission denied    Ten/etc/pam.d/passwd OneFind: '/etc/lvm/backup': Permission denied     AFind: '/etc/lvm/cache': Permission denied     -Find: '/etc/lvm/archive': Permission denied     -Find: '/etc/cups/ssl': Permission denied     theFind: '/etc/pki/rsyslog': Permission denied     -     -     -     +     -     +     AFind: '/etc/pki/ca/Private': Permission denied     atFind: '/etc/vmware-tools/guestproxydata/trusted': Permission denied     -Find: '/ETC/SUDOERS.D': Permission denied     -Find: '/etc/selinux/targeted/modules/active': Permission denied

2. Cat-b appends the contents of the Textfile1 and textfile2 documents to the TEXTFILE3 document after adding the line number (blank line):

[Email protected] ~/t2scripts $ cat-b E.log |Tee E3.log1/etc/passwd2Find: '/etc/ntp/crypto': Permission denied     3Find: '/etc/audisp': Permission denied     4Find: '/etc/audit': Permission denied      5Find: '/etc/polkit-1/localauthority': Permission denied     6Find: '/etc/dhcp': Permission denied     7/etc/pam.d/passwd8Find: '/etc/lvm/backup': Permission denied     9Find: '/etc/lvm/cache': Permission denied    TenFind: '/etc/lvm/archive': Permission denied     OneFind: '/etc/cups/ssl': Permission denied     AFind: '/etc/pki/rsyslog': Permission denied           -Find: '/etc/pki/ca/Private': Permission denied     -Find: '/etc/vmware-tools/guestproxydata/trusted': Permission denied     theFind: '/ETC/SUDOERS.D': Permission denied     -Find: '/etc/selinux/targeted/modules/active': Permission denied

3. Cat/dev/null empty the contents of the Ee.log document:

cat/dev/NULL

4. chattr +i: The file or directory shall not be arbitrarily altered.

[Email protected]/home/xiluhua/t2scripts $ chattr +/home/xiluhua/t2scripts $ rm-RF ttt.sh rm:cannot Remove ' ttt.sh': Operation not permitted

5. CHGRP (1)

 [email protected]/home/xiluhua/t2scripts # Touch ttt.sh[email  Protected] /home/xiluhua/t2scripts # ll ttt.sh -rw-r--r--. 1  root root  0  Jan : 22   ttt.sh[email protected] /home/xiluhua/t2scripts # chgrp Xiluhua ttt.sh [email protected] / Home/xiluhua/t2scripts # ll ttt.sh -rw-r--r--. 1  root xiluhua  0  Jan : 22  ttt.sh 

6. CHGRP (2)

Bash Shell programming Exercises

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.