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
  • 相关阅读:
    C# 内存映射研究学习
    js Promise async await 学习研究
    js 字节数组转数字以及数字转字节数组
    C# 生成一个当前程序唯一的短字符串
    C# FileStream 读取大文件时ReadByte和Read的速度对比
    用一个数维护最多32个可叠加状态,比如权限的状态,既有“读”,又有“写”
    大牛干货:100条Unity基础小贴士
    Unity教程之-Unity3d移动平台性能优化专题(12):面板的设置
    Unity ShaderLab学习总结
    (转)【Unity技巧】Unity中的优化技术
  • 原文地址:https://www.cnblogs.com/eRrsr/p/5848839.html
Copyright © 2011-2022 走看看