• linux的Shell常用快捷键

    日期:

    删除 ctrl + d 删除光标所在位置上的字符相当于VIM里x或者dl ctrl + h 删除光标所在位置前的字符相当于VIM里hx或者dh ctrl + k 删除光标后面所有字符相当于VIM里d shift+$ ctrl + u 删除光标前面所有字符相当于VIM里d shift+^ ctrl + w 删除光标前一个单词相...

  • SHELL读取文件的方法

    日期:

    1、shell判断文件,目录是否存在或者具有权限 #!/bin/ sh myPath = /var/log/httpd/ myFile = /var /log/httpd/access.log # 这里的 - x 参数判断$myPath是否存在并且是否具有可执行权限 if [ ! -x $myPath ]; then mkdir $myPath fi # 这里的 - d 参数判断$m...

  • linux shell脚本文件执行分析

    日期:

    一.shell脚本父子进程分析 代码: [cpp] view plain copy #!/bin/bash echo$$ ps-ef|grep`echo$$` echo ------------------------------------- (pwd;echo ; p s e f | g r e p e c h o `;) echo ------------------------------------- {pwd;echo ; p s e...

  • bash 编程中循环语句用法

    日期:

    1.if 是单分支语句,使用格式如下: if condition ; then statement .. fi 2.if else 是双分支语句,使用格式如下: if condition ; then statement . else statement . fi 3.if elifelifelse 是多分支语句,使用格式如下: if condition ; then statement ....

  • linux shell 逻辑运算符、逻辑表达式详解

    日期:

    一、逻辑运算符 逻辑卷标 表示意思 1. 关于档案与目录的侦测逻辑卷标! -f 常用!侦测『档案』是否存在 eg: if [ -f filename ] -d 常用!侦测『目录』是否存在 -b 侦测是否为一个『 block 档案』 -c 侦测是否为一个『 character 档案』 -S 侦测是否为一个『...

  • Linux下shell ping指定ip段

    日期:

    #! /bin/bash for a in {1..254} #不行就改成$(seq 1 254)或者for(()) do if ping -w 1 -c 1 192.168.1.$a | grep 100% /dev/null #表示ping一次变量的ip地址 (c1)表示ping一次 由于ping 的等待时间长 所以我定义了 参数 w l 表示等待超时的时间为1秒, the...

  • Linux shell之sort命令

    日期:

    Usage: sort [OPTION]... [FILE]... Write sorted concatenation of all FILE(s) to standard output. Mandatory arguments to long options are mandatory for short options too. Ordering options: -b, --ignore-leading-blanks ignore leading blanks -d...

  • Linux 找出大文件汇总

    日期:

    Q. 如何在目录中找出所有大文件? A. 1) 句法 for RedHat / CentOS / Fedora Linux find {/path/to/directory/} -type f -size +{size-in-kb}k -exec ls -lh {} \; | awk { print $9 : $5 } 实例: 查找当前目录下大于50MB的文件 $ find . -type f -size +5000...

  • linux shell if 参数

    日期:

    shell 编程中使用到得if语句内判断参数 b 当file存在并且是块文件时返回真 -c 当file存在并且是字符文件时返回真 -d 当pathname存在并且是一个目录时返回真 -e 当pathname指定的文件或目录存在时返回真 -f 当file存在并且是正规文件时返回真 -g 当由pathname...

  • linux正则表达式 grep egrep用法

    日期:

    shell命令执行的相应顺序 令1 命令2 如果这个命令1执行成功 那么执行这个命2 mv myfile myfile2 echo if you are seeing this then mv was success! || 如果| |左边的命令(命令1)未执行成功,那么就执行| |右边的命令(命令2) mv myfile myfile2 echo if yo...