随笔分类 -  Shell

摘要:1.创建shell脚本: !/bin/bash apphome=/apppath if [ ! d $apphome ]; then exit 0 fi cp $apphome/app.log $apphome/app.log. echo "" $apphome/app.log 运行后: 自动将当前 阅读全文
posted @ 2019-06-06 15:42 bamboo233 阅读(1882) 评论(0) 推荐(0)
摘要:Code: find . name " .sql" mtime +3 ls exec rm {} \; 阅读全文
posted @ 2019-03-14 09:28 bamboo233 阅读(816) 评论(0) 推荐(0)
摘要:需求:从FTP某目录取每日构建的apk下载到本地 难点:文件名中有构建时间,而这个时间不算固定值,因此文件名不固定 解决方案:mget匹配文件名后下载 BAT版本: :: Filename:Projectname_2019 03 04_0123.apk @echo off set date1=%da 阅读全文
posted @ 2019-03-04 14:01 bamboo233 阅读(686) 评论(0) 推荐(0)
摘要:date d '2 days ago' //显示2天前的时间,2019年 02月 10日 星期日 08:53:28 CST date d "2 days ago" +%Y%m%d //显示2天前的时间,20190210 date d '60 second ago' //显示60秒前的时间 date 阅读全文
posted @ 2019-02-12 09:06 bamboo233 阅读(28029) 评论(0) 推荐(0)
摘要:想弄个脚本,下载每日构建的版本,由于版本文件名中有构建时间(不是固定值),只能按日期确认文件名,例如:project_name_2019 01 04 .exe 搜索了下,可以用 以及 实现,下面是代码: ftp=10.0.0.1 user=username pwd=password date= fi 阅读全文
posted @ 2019-01-04 15:06 bamboo233 阅读(419) 评论(0) 推荐(0)
摘要:cat /etc/hosts | xargs I{} echo {} 阅读全文
posted @ 2018-12-24 14:02 bamboo233 阅读(460) 评论(0) 推荐(0)
摘要:cat a b | sort | uniq c c 是a和b的合集 cat a b | sort | uniq d c c 是a和b的交集 cat a b b | sort | uniq u c c 是a和b的不同 阅读全文
posted @ 2018-12-24 14:00 bamboo233 阅读(100) 评论(0) 推荐(0)
摘要:一、用户登陆进入系统后的系统环境变量 $HOME 使用者自己的目录 $PATH 执行命令时所搜寻的目录 $TZ 时区 $MAILCHECK 每隔多少秒检查是否有新的信件 $PS1 在命令列时的提示号 $PS2 当命令尚未打完时,Shell 要求再输入时的提示号 $MANPATH man 指令的搜寻路 阅读全文
posted @ 2018-12-21 17:11 bamboo233 阅读(257) 评论(0) 推荐(0)
摘要:我意外在/var/www/html/,而不是/home/projects/www/current下解压了一个tarball。它搞乱了/var/www/html下的文件,你甚至不知道哪些是误解压出来的。最简单修复这个问题的方法是: cd /var/www/html/ /bin/rm f "$(tar 阅读全文
posted @ 2018-12-21 16:40 bamboo233 阅读(204) 评论(0) 推荐(0)
摘要:1. 监控命令(每2秒运行一次) watch "ls larth" 2. 使用一个端口杀死程序 sudo fuser k 8000/tcp 3. 限制以下命令的内存使用 ulimit Sv 1000 1000 KBs = 1 MB ulimit Sv unlimited Remove limit 4 阅读全文
posted @ 2018-12-18 15:55 bamboo233 阅读(327) 评论(0) 推荐(0)
摘要:Compute the Average Given integers, compute their average correct to three decimal places. Input Format The first line contains an integer, . lines fo 阅读全文
posted @ 2018-12-14 16:31 bamboo233 阅读(567) 评论(0) 推荐(0)
摘要:本次使用的压缩格式是 .tar.gz,用到的命令如下: 压缩: tar czf jpg.tar.gz .jpg //将目录里所有jpg文件打包成jpg.tar后,并且将其用gzip压缩,生成一个gzip压缩过的包,命名为jpg.tar.gz tar czf dir.tar.gz /home/data 阅读全文
posted @ 2018-11-22 10:59 bamboo233 阅读(16699) 评论(0) 推荐(0)
该文被密码保护。
posted @ 2018-09-03 16:40 bamboo233 阅读(2) 评论(0) 推荐(0)
摘要:curl http://members.3322.org/dyndns/getip curl ip.6655.com/ip.aspx curl ifconfig.me curl icanhazip.com curl ident.me curl ipecho.net/plain curl whatis 阅读全文
posted @ 2018-07-24 15:40 bamboo233 阅读(7358) 评论(0) 推荐(0)
摘要:查找所有的 jpg 文件,并且压缩它们: find . type f name " .jpg" print | xargs tar czvf images.tar.gz 阅读全文
posted @ 2018-07-19 08:56 bamboo233 阅读(176) 评论(0) 推荐(0)
摘要:假如你有一个文件包含了很多你希望下载的 URL,你能够使用 xargs下载所有链接: cat url list.txt | xargs wget c 阅读全文
posted @ 2018-07-19 08:56 bamboo233 阅读(476) 评论(0) 推荐(0)
摘要:统计一个源代码目录中所有 php 文件的行数 阅读全文
posted @ 2018-07-19 08:55 bamboo233 阅读(277) 评论(0) 推荐(0)
摘要:用 rm 删除太多的文件时候,可能得到一个错误信息:/bin/rm Argument list too long. 阅读全文
posted @ 2018-07-19 08:54 bamboo233 阅读(204) 评论(0) 推荐(0)
摘要:Code: !/bin/bash function mkdirFun() { if [ ! d $1 ];then mkdir p $1 fi } filename=city1.txt date= while read line do echo $line tmp ProName= echo $Pr 阅读全文
posted @ 2018-06-21 10:37 bamboo233 阅读(179) 评论(0) 推荐(0)
摘要:Code: !/bin/bash date= ProName="广东市" CityName="广州市 汕尾市 阳江市 揭阳市 茂名市 江门市 韶关市 惠州市 梅州市 汕头市 深圳市 珠海市 佛山市 肇庆市 湛江市 中山市 河源市 清远市 云浮市 潮州市 东莞市" mkdir $ProName cd 阅读全文
posted @ 2018-06-21 09:37 bamboo233 阅读(478) 评论(0) 推荐(0)