1. 程式人生 > 其它 >提升工作效率的Linux命令

提升工作效率的Linux命令

ag

比grep,ack更快的遞迴搜尋檔案內容

[root@rabbitmq-2 html]# ag 'redis'
redis_pass.txt
1:#redis快取ip地址和埠
2:spring.redis.host = 10.10.10.1
3:spring.redis.port=16379
4:spring.redis.password=123456

tig

字元模式下互動檢視git專案, 可以替代git命令

mycli

mysql客戶端,支援語法高亮和命令補全,效果類似ipython,可以替代mysql命令。

 mkdir ~/.pip/
 cat > ~/.pip/pip.conf <<EOF
 [global]
 index-url = https://mirrors.aliyun.com/pypi/simple/

[install]
trusted-host=mirrors.aliyun.com
EOF
   

yum install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel libffi-devel gcc make
wget https://www.python.org/ftp/python/3.8.0/Python-3.8.0b3.tgz
tar -xvf Python-3.8.0b3.tgz
cd Python-3.8.0b3
./configure --prefix=/app/python/python3.8
make & make install
ln -s /app/python/python3.8/bin/python3.8 /usr/bin/python3.8
ln -s /app/python/python3.8/bin/pip3.8 /usr/bin/pip3.8
 pip3.8 install mycli


pip3.8 install mycli
systemctl start mariadb
mycli

vim /usr/bin/mycli
修改前 #!/usr/bin/python2
修改後 #!/usr/bin/python3.8

jq

** **json檔案處理以及格式化顯示,支援高亮,可以替換python -m json.tool。

shellcheck

shell指令碼靜態檢查工具,能夠識別語法錯誤以及不規範的寫法

fzf

命令列下模糊搜尋工具,能夠互動式智慧搜尋並選取檔案或者內容,配合終端ctrl-r歷史命令搜尋簡直完美。

PathPicker(fpp)

在命令列輸出中自動識別目錄和檔案,支援互動式,配合git非常有用。
執行以下命令:

git diff HEAD~8 --stat | fpp

htop

提供更美觀、更方便的程序監控工具,替代top命令

glances

更強大的 htop / top 代替者。
htop 代替 top,glances 代替 htop

資訊比 htop 豐富了不少,更全了,對吧?除了命令列檢視外,glances 還提供頁面服務,讓你從頁面上隨時檢視某伺服器的狀態;

axel

多執行緒下載工具,下載檔案時可以替代curl、wget

axel -n 20 http://centos.ustc.edu.cn/centos/7/isos/x86_64/CentOS-7-x86_64-Minimal-1511.iso

rz/sz

互動式檔案傳輸,在多重跳板機下傳輸檔案非常好用,不用一級一級傳輸

cloc

程式碼統計工具,能夠統計程式碼的空行數、註釋行、程式語言

[root@rabbitmq-2 html]# cloc ecology.sql 
       1 text file.
       1 unique file.                              
       0 files ignored.

github.com/AlDanial/cloc v 1.70  T=0.18 s (5.5 files/s, 110621.7 lines/s)
-------------------------------------------------------------------------------
Language                     files          blank        comment           code
-------------------------------------------------------------------------------
SQL                              1             74            221          19878
-------------------------------------------------------------------------------

script/scriptreplay

終端會話錄製

# 錄製
script -t 2>time.txt session.typescript
# your commands
# 錄製結束
exit
# 回放
scriptreplay -t time.txt session.typescript

11