
Linux及shell
夜阑卧听风吹雨,铁马冰河入梦来
用最孤独的时光塑造出最好的自己,才能笑着说起那些云淡风轻的过去~
展开
-
linux下使用sehll脚本启动,停止,重启服务
思路:启动脚本,判断服务进程pid是否存在,不存在调用命令启动停止服务: kill -9 pid 杀死服务进程重启:先杀死后启动status:根据pid查询服务是否运行查询pid命令可根据实际情况进行修改执行方法:给脚本加权限,chmod 777 server.sh./server.sh start./server.sh stop./server.sh restart./server.sh status#!/bin/bash#description: 启动重启原创 2020-12-09 09:59:33 · 626 阅读 · 0 评论 -
Shell脚本基础-if-then语句
1.if-then语句结构简单结构if command|conditionthen commandsfi带else结构if command|conditionthen commandselse commandsfi多层嵌套if command|conditionthen commandselif command|conditionthen commandselif command|conditionthen commandselse c原创 2020-06-03 10:52:00 · 14233 阅读 · 0 评论 -
shell脚本编程基础
1.hello.sh创建hello.sh 文件,增加执行权限 chmod +x hello.sh注释用#运行 终端下输入 ./hello.shecho的作用就是,把文本输出到标准输出,打印值有不带双引号的,也有带,都可以输出同样效果,这里建议加上双引号#!/bin/bash #第一行#!/bin/bash。表示这个脚本用什么去执行,#表示注释echo "hello shell"2.shell变量变量分系统变量和用户变量系统变量如$PATH,$BASH用户变量类似na原创 2020-06-02 16:44:53 · 949 阅读 · 0 评论 -
linux常用命令学习笔记
1.ls命令ls -al列出当前目录下所有文件及文件夹,l意为long,ls -t以时间顺序列出ls -R显示当前目录下的所有文件和文件夹及文件夹下的文件2.cd 切换工作目录cd test 切换到test目录下cd..切换到父目录cd 'my book'切换到文件名带空格的目录下3.cat 打开文件cat file 打开file文件cat file1 fi...原创 2020-04-30 14:09:54 · 1179 阅读 · 0 评论