上一页 1 ··· 4 5 6 7 8 9 10 11 12 ··· 73 下一页
摘要: 例一:元组:不可变,圆括号里面的逗号和列表十分类似,只不过元组和字符串一样是不可变的即你不能修改元组,元组通过圆括号中用逗号分割的项目定义。元组通常用在使语句或用户定义的函数能够安全地采用一组值的时候,即被使用的元组的值不会改变。#!/usr/bin/python# Filename: using_... 阅读全文
posted @ 2015-04-07 09:30 kin2321 阅读(192) 评论(0) 推荐(0) 编辑
摘要: tail -n 30 /var/log/messages | grep namedssh-keygen -b 1024 -t rsascp /root/.ssh/id_rsa.pub root@192.168.1.181:/root/.ssh/authorized_keysBchmod 600 /... 阅读全文
posted @ 2015-04-03 13:32 kin2321 阅读(145) 评论(0) 推荐(0) 编辑
摘要: 例一:监控httpd是否正常运行并自动开启#!/bin/bashport=$(nmap -sT localhost | grep 'http$' |awk '{print $2}')riqi=$(date +"%Y-%m-%d %H:%M")if [ "$port" == "open" ];then... 阅读全文
posted @ 2015-04-03 11:09 kin2321 阅读(164) 评论(0) 推荐(0) 编辑
摘要: 例一:数组选择#!/bin/shmenu=("Apple" "Grape" "Orange")PS3="喜欢哪个"select item in ${menu[@]};do echo "喜欢$item"done 阅读全文
posted @ 2015-04-02 16:54 kin2321 阅读(110) 评论(0) 推荐(0) 编辑
摘要: 例一:if的三种写法#!/bin/shmessage="Hello"if test "$message" = "Hello"; then echo "hello world"fiif [ "$message" = "Hello" ]; then echo "hello world... 阅读全文
posted @ 2015-04-02 13:52 kin2321 阅读(177) 评论(0) 推荐(0) 编辑
摘要: 1、查看cpu数目和核心数cat /proc/cpuinfo | grep core无论是ubuntu还是Centos 均可。2、查看内存free -mfree -g3、查看磁盘df -h du -sh /etc #-s的含义是统计所以,summarize,-h人性化显示 ,以M的形式。如果没有-... 阅读全文
posted @ 2015-04-02 11:17 kin2321 阅读(592) 评论(0) 推荐(0) 编辑
摘要: 方法一: 在/etc/profile文件中添加变量【对所有用户生效(永久的)】 用VI在文件/etc/profile文件中增加变量,该变量将会对Linux下所有用户有效,并且是“永久的”。 要让刚才的修改马上生效,需要执行以下代码 # source /etc/profile 方法二: ... 阅读全文
posted @ 2015-04-02 09:57 kin2321 阅读(1046) 评论(0) 推荐(0) 编辑
摘要: 1、自定义变量:举例:age=18;用户自己定义的变量,只能在当前shell生效。没有export 。2、环境变量:举例 export age2=19;子shell中也生效3、位置参数变量【也是预定义变量的一种,只是由于过多,单独拿出来】4、预定义变量总结1、系统自己的变量一般都是大写。无论自定义变... 阅读全文
posted @ 2015-04-02 09:18 kin2321 阅读(168) 评论(0) 推荐(0) 编辑
摘要: 背景:多台服务器来回切换,安装部署tomcat,浪费时间目的:一次修改,统一安装,统一部署。进程:ps -ef|grep tomcat|grep -v 'grep'|awk '{print $2}'shell脚本: 阅读全文
posted @ 2015-04-01 11:16 kin2321 阅读(201) 评论(0) 推荐(0) 编辑
摘要: 1、当前用户是rootroot用户修改密码 ,直接 passwd【不要输入当前用户密码】如果修改其他用户密码,需要passwd 用户名 如:passwd sc短短的密码,如123也能通过,因为是超级用户。2、当前用户是 user,如sc修改当前用户密码 passwd 【需要重新输入当前用户密码】而且... 阅读全文
posted @ 2015-03-31 14:28 kin2321 阅读(1066) 评论(0) 推荐(0) 编辑
上一页 1 ··· 4 5 6 7 8 9 10 11 12 ··· 73 下一页