Useful Commands/System Management: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
| Line 22: | Line 22: | ||
</source> | </source> | ||
|- | |- | ||
| | | CPU & Memory || | ||
<source lang="bash"> | <source lang="bash"> | ||
# Linux | |||
cat /proc/cpuinfo | cat /proc/cpuinfo | ||
cat /proc/meminfo | cat /proc/meminfo | ||
free | free | ||
</source> | </source> | ||
|- | |- | ||
| | | Locale || | ||
<source lang="bash"> | <source lang="bash"> | ||
sudo locale-gen | locale # current locale | ||
locale -a # available locales | |||
sudo locale-gen # rebuild locales | |||
</source> | </source> | ||
|- | |- | ||
Revision as of 09:18, 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 & Memory |
# Linux
cat /proc/cpuinfo
cat /proc/meminfo
free
|
| Locale |
locale # current locale
locale -a # available locales
sudo locale-gen # rebuild locales
|
| 一分鐘後執行指令 |
echo "ls -l > `tty`" | at now + 1 minute
|