zoukankan      html  css  js  c++  java
  • linux命令学习_实验楼(总结)

    课程地址:https://www.shiyanlou.com/courses/68

    ls -alh d*
    cd –
    pwd 
    mkdir -mvp ./{lib/,bin/,doc/{info,product}}
    rm -i *.log
    mv a.log b.log
    mv -i a.txt test1 
    cp -iu test1/* test2    cp -s 
    cat -ns a.log > b.log 带行号显示,空行也算   cat还可合并文件
    nl -b t a.log
    nl -n ln a.log  带行号显示(空行不算)(-n在最左方显示)
    ll /etc | more -10  常用操作 = b p space
    more +/g a.log查找第一个出现“g”字符串的行,并从该处前两行开始显示输出  
    ps -f | less -N /字符串	向下搜索“字符串”的功能
    head -n 5 a.log  b.log
    ping www.baidu.com >> a.log &   tail -n 5 -f a.log自动更新显示
    which gcc PATH变量指定的路径中搜索可执行文件的所在位置
    whereis -bms gcc变量指定的路径中搜索可执行文件的所在位置
    locate /etc/*lou*搜索 etc 目录下文件名包含 lou 的文件,可以使用如下命令:
    find . ( -name "*.pdf" -or -name "*.txt" )括号提高可读性
    find . -type f ( ! -perm 777 -and ! -perm 644 )
    find . -name "*.php" -exec ls -l {} ;单命令
    find . -name "*.c" -exec ./command.sh {} ;多命令写进脚本文件
    find . -type f -name "*.c" | xargs wc -l有些命令只能以命令行参数的形式接收数据,而无法通过 stdin 接收数据流,查找当前目录下所有 c 代码文件,统计总行数
    ls /bin | wc -l
    grep -nr "main()".在当前目录下递归搜索文件中包含 main() 的文件
    grep -E "^0[0-9]{2,3}-[0-9]{7,8}(-[0-9]{3,4})?$" telphone.txt grep 把.当成 shell 通配符,不是正则表达式的元字符需要加-E 选项
    cut -f 1,3 -d ' ' student.txt当分割符为制表符则省略-d,不然-f不起效果
    echo -n $str | cut -b `echo -n $str | wc -c`取出字符串str的最后一个字符
    paste与 cut 相反。它通过读取多个文件中的字段整合成单个文本流,输入到标准输出。
    paste student.txt telphone.txt -d ':'内容按列拼接,指定分隔符为:
    echo 'IS' | tr 'A-Z' 'a-z'  echo 'IS123IS' | tr -d '0-9'只接受标准输入
    df -h
    du -ch file1.txt file2.txt  -c统计总和du -h | sort -nr | head -10
    { time date; } 2>1.txt通过这种方法打印time的标准错误输出
    ls -l /usr/bin/ | sort -nr -k 5 | head -10使用第5个字段进行排序
    ls /bin /usr/bin | sort | uniq -d将排过序的文件作为输入,找出相同的命令
    join -1 3 -2 3 c.txt d.txt指定两个文件的第三个字段为匹配字段连接两个文件
    comm -12 file1.txt file2.txt不显示第一二列,即仅显示共有列
    diff  -c a.txt  b.txt特殊字符记住:所有操作目的是将第一个文件变成第二个
    diff  -Naur file1.txt  file2.txt > patchdiff.txt
    patch < patchdiff.txt应用 patch 命令更新file1.txt文件
    patch -R < patchdiff.txt取消上面例一打过的补丁
    

      

  • 相关阅读:
    Linux下端口被占用,关掉端口占用的方法
    对于STM32F103的USART的通讯调试
    第一次本地代码提交到github
    SPI的学习和ESP8266的SPI通讯测试
    ubuntu下minicom安装和简单设置使用
    ubuntu18.04下stlink的一种安装方法
    使用arm-none-eabi-gdb报错error while loading shared libraries: libncurses.so.5: cannot open shared object file: No such file or directory
    在麦芒5手机播放音乐时APPS连上后出现自动重启了(请查找:REBOOT关键字)
    一连上蓝牙后,按音量加键,死机(有LOG)
    启动后,只连上蓝牙后,播放音乐,这时按音量,播放,暂停都没功能(按键是有作用的)
  • 原文地址:https://www.cnblogs.com/exciting/p/13171254.html
Copyright © 2011-2022 走看看