Useful Commands/System Management: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
| Line 32: | Line 32: | ||
| Locale || | | Locale || | ||
<source lang="bash"> | <source lang="bash"> | ||
locale | locale # current locale | ||
locale -a | locale -a # available locales | ||
sudo locale-gen # rebuild locales | sudo locale-gen # rebuild locales | ||
</source> | </source> | ||
|- | |- | ||
| | | Run a command one minute later || | ||
<source lang="bash"> | <source lang="bash"> | ||
echo "ls -l > `tty`" | at now + 1 minute | echo "ls -l > `tty`" | at now + 1 minute | ||
</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
|
| Run a command one minute later |
echo "ls -l > `tty`" | at now + 1 minute
|