好啦。从今天开始我们转入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
~

 一   shell编程

 

 

第三章

 

登录远程主机

shh -l 用户名+IP

shh 用户名@+IP

ssh +IP 默认root登录

 文件+目录

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

一   shell编程

 

 

查看文档类型

ls -la   列出所有文件all

 ls-ld   列出目录文件 d 

file 查找

file +路径

查找当前的工作路径 

pwd 命令

 

相关文章:

  • 2022-01-05
  • 2022-12-23
  • 2021-08-15
  • 2021-12-06
  • 2021-05-16
  • 2021-11-17
  • 2021-04-02
猜你喜欢
  • 2021-04-11
  • 2022-01-15
  • 2021-10-09
  • 2021-05-17
  • 2021-08-31
相关资源
相似解决方案