zoukankan      html  css  js  c++  java
  • Linux_几个符号命令

    一、管道符号 | (将前面命令的输出结果传给后面的命令)

    [eRrsr@hadoop09-linux ~]$ cat /etc/passwd | grep "^root"
    root:x:0:0:root:/root:/bin/bash

    二、重定向符号 [>] [<]

    [root@hadoop09-linux ~]# df > /usr/tmp/df.txt # >:输入重定向 即将命令结果重定向给df.txt,需要root权限,df.txt若不存在则新建
    [root@hadoop09-linux ~]# cat /usr/tmp/df.txt 
    Filesystem           1K-blocks      Used Available Use% Mounted on
    /dev/sda2             18339256   2757204  14650468  16% /
    tmpfs                   506272        72    506200   1% /dev/shm
    /dev/sda1               297485     33538    248587  12% /boot
    /dev/sr0               4251346   4251346         0 100% /media
    [root@hadoop09-linux ~]# wc -l < /usr/tmp/df.txt  # <:输出重定向 即将df.txt输出给wc命令 -l:统计行数
    5
    [root@hadoop09-linux ~]# pwd > /dev/null       # 若要执行命令,但不要求输出,可以重定向到/dev/null
    [root@hadoop09-linux ~]# 

    三、追加符号 [>>] [<<]

    [root@hadoop09-linux ~]# df >> /usr/tmp/df.txt 
    [root@hadoop09-linux ~]# cat /usr/tmp/df.txt 
    Filesystem           1K-blocks      Used Available Use% Mounted on
    /dev/sda2             18339256   2757204  14650468  16% /
    tmpfs                   506272        72    506200   1% /dev/shm
    /dev/sda1               297485     33538    248587  12% /boot
    /dev/sr0               4251346   4251346         0 100% /media
    Filesystem           1K-blocks      Used Available Use% Mounted on
    /dev/sda2             18339256   2757208  14650464  16% /
    tmpfs                   506272        72    506200   1% /dev/shm
    /dev/sda1               297485     33538    248587  12% /boot
    /dev/sr0               4251346   4251346         0 100% /media
    [root@hadoop09-linux ~]# cat << eof   # eof 文档起点
    > hello Linux               # 文档内容第一行
    > Linux: Hello eRrsr           # 文档内容第二行
    > eof                   # eof 文档终点 
    hello Linux
    Linux: Hello eRrsr

    四、预执行符 ``(反引号ESC下面)

    [root@hadoop09-linux tmp]# ll `find /etc -name init -a  -type f -a -size +5`
    -rwxr-xr-x. 1 root root 4781 Oct 29  2009 /etc/kdump-adv-conf/kdump_initscripts/init

    五、家目录 ~

    [root@hadoop09-linux ~]# pwd
    /root
    [root@hadoop09-linux ~]# su - eRrsr
    [eRrsr@hadoop09-linux ~]$ pwd
    /home/eRrsr
  • 相关阅读:
    【jQuery基础学习】03 jQuery中的事件与动画
    【jQuery基础学习】02 jQuery的DOM操作
    【jQuery基础学习】01 jQuery选择器
    【jQuery基础学习】00 序
    【JS复习笔记】07 复习感想
    【JS复习笔记】06 方法
    洛谷P1067 多项式输出 NOIP 2009 普及组 第一题
    嵊州D6T2 城市 city
    博弈论小结
    嵊州D2T4 十七个中毒的英国人 poisoning
  • 原文地址:https://www.cnblogs.com/eRrsr/p/5848839.html
Copyright © 2011-2022 走看看