常用命令

1. 查找當(dāng)前目錄下大于100M的文件

find . -type f -size +100M -exec ls -lh {} \; | awk '{ print $9 ":" $5 }';

2. 查看系統(tǒng)版本

lsb_release -a

3. 定時任務(wù)

crontab -e

*/5 * * * * /home/smart/monitor-data-collector.sh? >/dev/null 2>&1

4. linux計算器? 計算浮點

yum -y install bc

if [ `echo "1.1 > 1" | bc` -eq 1 ];then

? ? echo "OK"

fi

5. 檢查硬盤是否有壞盤

smartctl -H /dev/sdb4

df -h /dev/sdg4 | awk NR==2 | awk '{print $5}' | awk -F% '{print $1}'

nat server protocol tcp global 14.119.109.131 53 inside 172.16.8.10 53

6. 修改mtu值? mtu是分片的基礎(chǔ),從而影響網(wǎng)速慢問題,ping大包不通原因是對端不允許分片,且兩端mtu設(shè)置不一致導(dǎo)致

# vi /etc/sysconfig/network-scripts/ifcfg-eth0

#增加如下內(nèi)容

MTU="1496"

重啟生效

臨時修改

# echo "1496" > /sys/class/net/eth0/mtu

兩者結(jié)合使用

mysql -u root -p -e 'SHOW /*!50000 GLOBAL */ STATUS LIKE "Questions"'

7. 查看前K個最占內(nèi)存的進程

ps -aux | sort -k3nr | head -K

8. 禁止某個IP訪問

iptables -A INPUT -p tcp -s 192.168.1.2 -j DROP

9. 刪除規(guī)則

iptables -D INPUT 2

刪除INPUT鏈編號為2的規(guī)則

10. 關(guān)閉防火墻 centos7

sudo systemctl stop firewalld.service

11. svn創(chuàng)建分支

svn cp -m "create branch v3" svn://116.8.117.135/bigdata/trunk/lcportal/codes/portal svn://116.8.117.135/bigdata/trunk/lcportal/branch/v2.0/portal

12. ssh 無法登陸 查詢系統(tǒng)登陸日志:No supported key exchange algorithms

進入cd /etc/ssh/

刪除加密文件rm -rf ssh_host_*

重啟sshd service sshd restart

(ssh -v root@xxx 可查看日志;查看登陸日志:/var/log/secure)

13. yum 鏡像超時問題

可能與mtu設(shè)置有關(guān)

14. 刷新數(shù)據(jù)庫權(quán)限

flush privileges

15. 安裝pip install mysqlclient 時,報錯:EnvironmentError: mysql_config not found

先安裝mysql-devel,然后安裝

MySQLdb庫不支持 python3.5+

16. 啟動python3環(huán)境

$ python3 -m venv py3

$ source /opt/py3/bin/activate

17. elk 字段包含

{

? "bool": {

? ? "must": [

? ? ? {

? ? ? ? "match": {

? ? ? ? ? "uri": "aboutUs.html"

? ? ? ? }

? ? ? }

? ? ]

? }

}

18. 下載python庫慢問題解決

pip? install --index https://pypi.mirrors.ustc.edu.cn/simple/ pandas

--index 使用指定鏡像

19. tomcat 插入數(shù)據(jù)庫中文亂碼

db.url=jdbc:mysql://127.0.0.1:3306/test?useUnicode=true&characterEncoding=utf8

20. windows可以ping通外網(wǎng),但是不能打開網(wǎng)頁;mtu設(shè)置問題

cmd下,查看:netsh interface ipv4 show subinterfaces

修改:netsh interface ipv4 set subinterface "本地連接 2" mtu=1496 store=persistent

21. javax.crypto.BadPaddingException: Given final block not properly padded

當(dāng)des密鑰不一致時會出現(xiàn)次錯誤

22. Caused by: java.lang.IllegalArgumentException: Malformed \uxxxx encoding.

路徑部分使用了\而不是/,系統(tǒng)默認(rèn)解析\u的形式,應(yīng)該使用\\或者/

23. xencenter修改root密碼,單用戶模式輸入passwd無效

單用戶進入:

xencenter 選擇 虛擬機 右鍵 屬性-》 引導(dǎo)項? -> 增加single

修改密碼:

field=$(awk -F ':' '/^root/{print $2}' /etc/shadow)

password=$(openssl passwd -1 27WZFM9A03)

sed -i '/^root/s%'$field'%'$password'%' /etc/shadow

24. cloudapi建立分支

svn cp -m "create branch" svn://116.8.117.135/bigdata/trunk/cloudApi/codes/cloudapi svn://116.8.117.135/bigdata/trunk/cloudApi/codes/branch/cloudapi

25. eclipse 項目根部錯誤消除

修改根目錄下.settings 文件夾下org.eclipse.wst.common.project.facet.core.xml文件的tomcat屬性

26. 查看當(dāng)前centos 端口使用

netstat -ntlp

27. hadoop 安裝方式

http://blog.csdn.net/cafebar123/article/details/73500014

28. centos hostname 修改

/etc/sysconfig/network

:HOSTNAME=localhost.localdomain

/etc/hosts

127.0.0.1 localhost.localdomain localhost

hostname your-hostname

29. windows設(shè)置mtu

查看接口名

netsh interface ipv4 show subinterfaces

設(shè)置

netsh interface ipv4 set subinterface "以太網(wǎng)" mtu=1496 store=persistent

30. mysql用戶賦權(quán)

grant all privileges on cfs.* to lychee@'%' identified by 'lychee@!2018';

31. tar加密解密

tar -czvf - ./201803 | openssl des3 -salt -k lychee@23 -out ../../eac/logs/201803.tar

openssl des3 -d -k lychee@23 -salt -in 201802.tar | sudo tar xvf -

32. wget下載參數(shù)問題

需要在&前面加\轉(zhuǎn)義符號

wget http://cfs.lychee-info.cn/eac-console/servlet/appServlet.action?method=downloadLogger\&name=201801.tar

33. mysqldump

導(dǎo)出表

mysqldump -h10.0.100.19 -uroot -p eac CA_TELECOM_ACCOUNT > ca_account.dump

導(dǎo)入

mysql -h10.34.1.100 -uroot -p cloudapi3333333你3 < ca_account.dump

34. 更新mysql數(shù)據(jù)庫密碼

update mysql.user set authentication_string=password('507866f07b472850') where user='root';

?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

  • 你了解自己對日常生活用品的偏愛嗎?肯定有的,這里藏著你的生活理念和過往。 我發(fā)現(xiàn)我喜歡塑料盆和杯子。 喜...
    螢火蟲8848閱讀 512評論 1 3
  • 文/蓮素 怪奇事件簿目錄 上一章 【玄幻】怪奇事件簿︳器靈之泣 2 柚姬回到家中,推開門,玄關(guān)處并沒有父親的鞋子,...
    蓮素閱讀 308評論 6 9
  • 最近入手了一臺MBP(Mac Book Pro),從Windows系統(tǒng)轉(zhuǎn)入Mac系統(tǒng),學(xué)習(xí)的成本還是比較高的,比如...
    亦楓閱讀 1,561評論 1 10

友情鏈接更多精彩內(nèi)容