一些Linux shell
生活随笔
收集整理的這篇文章主要介紹了
一些Linux shell
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
以下shell在centos下使用.?
獲取一個壓縮軟件包的version(版本)
huwei@huwei:/work/lnmp$?ll?-a?php.tar.gz -rw-rw-r--?1?huwei?huwei?18355694??3月?15?14:32?php.tar.gz huwei@huwei:/work/lnmp$?tar?-ztf?php.tar.gz|tail?-1|awk?-F'/'?'{print?$1}' php-5.6.19隨機密碼,對于mysql,不方便使用下劃線以及特殊符號,使用mysqldump備份會失敗.
passVar=`cat?/dev/urandom?|?tr?-dc?"a-zA-Z0-9"|?fold?-w?20?|head?-n?1`檢查是否存在mysql用戶,如果不存在側創建
通過find命令查找大文件
huwei@huwei:~$?sudo?find?/home/huwei/?-type?f?-size?+6G?-ls 20319458?647×××?-rw-------???1?huwei????huwei????6637486080??3月??2?14:15?/home/huwei/VirtualBox\?VMs/test50/Snapshots/{644badc2-a908-4e74-a2ec-a03f52b21578}.vdi判別系統是32bit還是64bit
if???[[??"`/usr/bin/getconf?LONG_BIT`"?-eq?32?]];thenecho?"system?is?32bit"; elif?[[??"`/usr/bin/getconf?LONG_BIT`"?-eq?64?]];thenecho?"system?is?64bit"; fi查找當前文件夾下后綴名為“.”的文件,重新命令為無后戳
比如2011114411. 命令為2011114411
ls?*.|awk?-F'.'?'{print?$1}'|xargs?-i?-t?mv?{}.?{}轉載于:https://blog.51cto.com/huwei555/1751310
總結
以上是生活随笔為你收集整理的一些Linux shell的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 图论相关算法理解和总结
- 下一篇: 构建LINUX下的入侵检测系统——LID