zoukankan      html  css  js  c++  java
  • 一 shell编程

    好啦。从今天开始我们转入shell编程的行列。从鸟哥私房菜中,已经学到了一些shell编程的皮毛,这两个月打算系统的学习,学会,学熟练。加油吧

    bash shell

    [root@localhost shellscript]# chmod +x hello.sh
    [root@localhost shellscript]# sh hello.sh
    hello world
    [root@localhost shellscript]# vim hello.sh
    #!bin/bash
    #这是第一个shell
    #echo "hello world"
    
    cp /dev/null /var/log/apache/access.log    利用/dev/null来清空 apache2的日志文件    /dev/null我们再鸟哥的书中看到过。我也查过,就是个黑洞,垃圾箱

    做一个每天凌晨6点清空日志文件的shell

    [root@localhost shellscript]# cp hello.sh clearlog.sh
    [root@localhost shellscript]# chmod +x clearlog.sh
    [root@localhost shellscript]# cat chearlog.sh
    cat: chearlog.sh: 没有那个文件或目录
    [root@localhost shellscript]# cat clearlog.sh
    #!bin/bash
    #这是第一个shell
    #echo "hello world"

    cp /dev/null /var/log/apache/access.log
    [root@localhost shellscript]# crontab -u root -e
    0 6 * * * /root/shellscript/cleanlog.sh
    ~

     

    第三章

    登录远程主机

    shh -l 用户名+IP

    shh 用户名@+IP

    ssh +IP 默认root登录

     文件+目录

    在鸟哥的书中已经有介绍。不多讲,其中有关管道的还有点嚼头

    查看文档类型

    ls -la   列出所有文件all

     ls-ld   列出目录文件 d 

    file 查找

    file +路径

    查找当前的工作路径 

    pwd 命令

  • 相关阅读:
    [asp.net core]SignalR一个例子
    [Asp.net core]bootstrap分页
    ${pageContext.request.contextPath}无法解析
    [Java web]Spring+Struts2+Hibernate整合过程(2)
    [Java web]Spring+Struts2+Hibernate整合过程
    java.lang.IllegalStateException: Failed to load ApplicationContext
    [Struts2]配置文件
    unihtmlmemo使用
    ADO序列
    variant和rawbytestring相互转换
  • 原文地址:https://www.cnblogs.com/Lonelychampion/p/11550451.html
Copyright © 2011-2022 走看看