Useful Commands/System Management: Difference between revisions

From Fundamental Ramen
Jump to navigation Jump to search
No edit summary
No edit summary
Line 35: Line 35:
<source lang="bash">
<source lang="bash">
free
free
</source>
|-
| 執行一個工作,同時輸出到畫面上也寄到信箱 ||
<source lang="bash">
# TODO
ls -l | tee ${SSH_TTY} | ???
</source>
|-
| 查詢應用程式預設值 (OSX) ||
<source lang="bash">
defaults find {關鍵字} <nowiki>|</nowiki> less
</source>
|-
| 讀取應用程式預設值 ||
<source lang="bash">
defaults read {關鍵字} <nowiki>|</nowiki> less
</source>
</source>
|-
|-
Line 66: Line 50:
<source lang="bash">
<source lang="bash">
sudo locale-gen
sudo locale-gen
</source>
|-
| 變更使用者語系 ||
<source lang="bash">
</source>
</source>
|-
|-

Revision as of 09:07, 8 March 2019

情境 指令
List process
ps -axo pid,command
ps -axo pid,command | awk 'match($2, /^ssh/) { print $0; }'
ps -axo pid,command | awk 'match($2, /^login/) { print $0; }'
ps -axo pid,command | awk 'match($2, /^-?bash/) { print $0; }'
List process tree
# Mac/BSD
pstree -p 713
pstree $(ps -axo pid,command | awk 'match($2, /^login/) { print $1 }')

# Linux
pstree 713
pstree -p $(ps -acxo pid,command | awk '/sshd/{print $1}' | head -n 1)
pstree -p $(ps -acxo pid,command | awk '/bash/{print $1}' | tail -n 2 | head -n 1)
顯示CPU資訊
cat /proc/cpuinfo
顯示記憶體資訊
cat /proc/meminfo
釋放記憶體並且顯示記憶體資訊
free
檢查使用中的語系
locale
檢查可使用的語系
locale -a
重建語系定義檔
sudo locale-gen
一分鐘後執行指令
echo "ls -l > `tty`" | at now + 1 minute