zoukankan      html  css  js  c++  java
  • liunx命令

    (2)sudo -i 通过这种方法输入当前管理员用户的密码就可以进到root用户。

    tar -cvf target_name.tar dir_or_file # 将目标打包成一个*.tar格式的文件

    tar -czvf target_name.tar.gz dir_or_file # 将目标打包并压缩成一个*.tar.gz格式的文件

    tar -cjvf target_name.tar.bz2 dir_or_file # 将目标打包并压缩成一个*.tar.bz2格式的文件 

    du -sh /var/lib/docker/containers/* | sort -nr

    du -hxa --max-depth=3 / | sort -h

    :g/str1/s//str2/g

    zip -r crypto-config.zip  ./crypto-config/*

    端口占用

    netstat -aon|findstr "49157"

    netstat -anpc |grep 10440
    (Not all processes could be identified, non-owned process info
     will not be shown, you would have to be root to see it all.)
    tcp6       0      0 :::10440                :::*                    LISTEN      28879/java          
    >ps -ef | grep 28879

    ll -h 显示文件大小

    grep的-A, -B, -C选项分别可以显示匹配行的后,前,后前多少行内容:

    cat myb-service.all.log | grep --count -B 1 '短信发送失败'   --计算总行数
    cat myb-service.all.log | grep  -B 1 '短信发送失败'  | grep 'userId' >>1.txt  --显示短信发送失败前一行

    cat catalina.2016-05-27.out |grep -C 200  '查询用户开户信息userId=709111956' | grep 'DealFastOpenAccountLogic'

     find /app/server -mmin    +60

     tail -100f  catalina.2016-10-26.out

    less file  ; q 退出

    对于一些很大的log文件,我们用more查看时会很费劲,没有办法直接跳到末尾再向前查看。

    我们可以用less来解决,less查看一个文件时,可以使用类似vi的command命令,在command模式下按G跳到文件末尾,再使用f或B来翻页。

    然后Ctrl+G

    然后 

    按f键,是向前查看  forword

    按b键,是向后查看 backword

    more 从前往后

  • 相关阅读:
    Object.keys方法之详解
    ackbone入门系列(5)路由
    backbone入门系列(4)集合
    backbone入门系列(3)视图
    backbone入门系列(2)模型
    backbone入门系列(1)基本组成部分
    $(document).ready(function(){ })、window.onload=function(){}与(function($){...})(jQuery)的对比和作用
    backbone笔记1,MVC
    用Object.prototype.toString()来检测对象的类型
    Python生成requirements.txt方法
  • 原文地址:https://www.cnblogs.com/clds/p/5869435.html
Copyright © 2011-2022 走看看