您的位置:首页 > 运维架构 > Linux

linux命令整理

2017-01-23 10:13 253 查看
1.) 显示文件夹下各个文件大小(包含目录和文件)

du -hs *

2.) shell校验日期格式有效性

#!/bin/sh

# para
#     $1 date format
#     $2 date value
#     if input bit not enough, result comes to be wrong
function check_date()
{
echo "##### " $* " #####"

if [[ "$2" = `date -d "$2" +"$1"` ]]
then
echo "format($1) date($2)" right
return 0;
else
echo "format($1) date($2)" wrong
return 1;
fi
}

check_date "$1" "$2"
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: