设为首页 收藏本站
查看: 661|回复: 0

[经验分享] Red Hat RHCSARHCE 7 Cert Guide(二)

[复制链接]
累计签到:161 天
连续签到:1 天
发表于 2017-4-17 17:00:30 | 显示全部楼层 |阅读模式
13.A symbolic link (also referred to as soft link) does not link directly to the inode but
        to the name of the file,symbolic links is that they can link to files on other devices, as well as on directories
14. hard link -->  inode --> datablocks
        sombolic link --> hard link --> inode --> datablocks
15.to create hard links, you must be the owner of the item that you want to link to.
        This is a new security restriction that has been introduced in RHEL 7
16.tar -cvf archivename.tar /files-you-want-to-archive
        tar -rvf /root/homes.tar /etc/hosts  #add the /etc/hosts file to the archive       
        tar -uvf /root/homes.tar /home  #write newer versions of all files in /home to the archive.
        tar -tvf /root/homes.tar  #ee the contents         of the tar archive
        tar -xvf homes.tar -C /tmp
        tar -xvf /archivename.tar /file-you-want-to-extract
        tar -xvf /root/etc.tar /etc/hosts   #archive etc.tar contains the file /etc/hosts that you want to extract
17.gzip or bzip2
        -z (gzip) or -j (bzip2)
        Options:
                c Creates an archive.
                v Shows verbose output while tar is working.
                f Used to specify the name of the tar archive that is to be used. Without using this
                option, the default destination is STDIN for -x and STDOUT for -c .
                t Shows the contents of an archive.
                z Compresses/decompresses the archive while creating it, by using gzip.
                j Compresses/decompresses the archive by using bzip2.
                x Extracts an archive.
                u Updates an archive; only newer files will be written to the archive.
                C Changes the working directory before performing the command.
                r Appends files to an archive.
***************************************************************************************************************
1.vim and man :That is because all of these commands are based on the same code
2.tail -n 5 /etc/passwd(tail -5 /etc/passwd)
        tail -f /var/log/messages #n real-time messages that are written to the main log file /var/log/messages
3.head -11 /etc/passwd |tail -n 1  #see line number 11 of the /etc/passwd file
        head -n 5 /etc/passwd #show the first five lines in /etc/passwd
        tail -n 2 /etc/passwd #show the last two lines of /etc/passwd
4.cut
        -d option to specify the field delimiter followed by
        -f with the number of the specific field you want to filter out
        cut -f1 -d: /etc/passwd
5. cut -f1 -d: /etc/passwd |sort #sorts the contents of the first column in the /etc/passwd file       
6.sort :By default, the sort command sorts in alphabetic order.
        cut -f2 -d: /etc/passwd | sort -n #sort the second field of the /etc/passwd file in numeric order
        du -h | sort -rn #get a list of files sorted with the biggest file in that directory listed first
        sort -k3 -n -t: /etc/passwd #不能缺少-n选项
        ps aux |sort -k3 -n

7. wc file :the number of lines, the number of words, and the number of characters.
8.grep
        grep anna /etc/passwd
        grep ^anna /etc/passwd begin with the text anna
        grep ash$ /etc/passwd  end with the text ash .
        *************************************************************************
        prevent the regular expression from being interpreted by the shell
        grep '^anna' /etc/passwd
        *************************************************************************
9.Regular Expression
        ^text Line starts with text.
        text$ Line ends with text.
        . Wildcard. (Matches any single character.)
        [abc] Matches a, b, or c.
        * Match 0 to an infinite number of the previous character.
        \{2\} Match exactly 2 of the previous character.
        \{1,3\} Match a minimum of 1 and a maximum of 3 of the previous character.
        colou?r Match 0 or 1 of the previous character. This makes the previous character optional,which in this example would match both color and colour .
        "/web(/.*)?":the regular expression (/.*)?, which means zero or one (/.*)
10.grep(general regular expression parser):
        -i Not case sensitive. Matches uppercase as well as lowercase.
        -v Only show lines that do not contain the regular expression.
        -r Search files in the current directory and all subdirectories.
        -e Use this to search for lines matching more than one regular expression.
        -A <number> Show <number> of lines after the matching regular expression.
        -B <number> Show <number> of lines before the matching regular expression.

        grep '^#' /etc/sysconfig/sshd
        grep -v '^#' /etc/sysconfig/sshd
        grep -v '^#' /etc/sysconfig/sshd -B 5
        grep -v -e '^#' /etc/sysconfig/sshd
11.awk and sed:
        awk -F: '{print $4}' /etc/passwd #shows the fourth line from /etc/passwd
        awk -F: '/user/ {print $4}' /etc/passwd #searches the /etc/passwd file for the text user and will print the
                fourth field of any matching line
        sed -n 5p /etc/passwd #print the fifth line from the /etc/passwd file
        sed -i s/old-text/new-test/g ~/myfile  #-i will write the result directly to the file
        sed -i -e '2d' ~/myfile #you can delete a line based on a specific line number
        sed -i -e '2d;20,25d' ~/myfile #delete lines 2 and 20 through 25 in the file ~/myfile.


运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-365445-1-1.html 上篇帖子: centos6.5 x86_64 配置openstack i版 下篇帖子: DNS and BIND(一)
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表