Linux經常使用命令彙總

參考連接:html

http://linuxtools-rst.readthedocs.io/zh_CN/latest/base/01_use_man.htmllinux

http://ganquan.info/linux/?p=1shell

 

1計算文件的 md5 bash

md5sum filename 服務器

 

2、根據指定條件查找指定文件ssh

find <指定目錄> <指定條件> <指定動做> tcp

locate 文件路徑spa

 

3、查找系統命令的位置nuxt

which 命令名稱rest

 

4、查詢指定程序名稱的程序所在的目錄

whereis 程序名稱

 

5、查找指定命令是shell自帶的仍是外部獨立二進制文件提供的

type 命令名稱

 

6查看指定端口的進程號

fuser -v -n tcp 端口號

 

7、解壓指定壓縮文件

tar -xf filepath

 

8、關閉防火牆,重啓後復原

service iptables stop

 

9、關閉防火牆,重啓後不復原

chkconfig iptables off

 

10、設置 SSH 不斷開連接:

http://hbwanghai.blog.163.com/blog/static/1992971472012224105110918/

 

11、強制刪除文件或者目錄

rm -rf directoryPath or filePath

 

12、強制殺死指定進程

kill -9 pid

 

13、查詢指定進程的狀態

ps -ef | grep processName

 

14、文本處理

http://linuxtools-rst.readthedocs.io/zh_CN/latest/base/03_text_processing.html

 

15、給指定命令指定別名、解除別名

臨時生效:

alias cls="clear"

unalias cls

如需永久生效,需編輯:/etc/.bashrc 文件。

 

16vi亂碼問題

http://www.ichiayi.com/wiki/tech/vi_utf8

 

17、強行關閉指定服務

ps -ef | grep serviceName | grep -v grep | cut -c 9-15 | xargs kill -s 9

 

1八、查看服務器登陸歷史

last -a -n 5

 

1九、修改默認的ssh端口

vi /etc/ssh/sshd_config

Prot 22

Port 2223

/etc/init.d/sshd restart

檢查防火牆,確認端口以開放便可

相關文章
相關標籤/搜索