Useful Commands/System Management: Difference between revisions
Jump to navigation
Jump to search
(Created page with "{| class="wikitable" ! 情境 || 指令 |- | 顯示CPU資訊 || <source lang="bash"> cat /proc/cpuinfo </source> |- | 顯示記憶體資訊 || <source lang="bash"> cat /proc/...") |
(→TODO) |
||
| (18 intermediate revisions by the same user not shown) | |||
| Line 1: | Line 1: | ||
== OS Management == | |||
123 | |||
== TODO == | |||
{| class="wikitable" | {| class="wikitable" | ||
! 情境 || 指令 | ! 情境 || 指令 | ||
|- | |- | ||
| | | List process || | ||
< | <syntaxhighlight lang="bash"> | ||
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; }' | |||
</syntaxhighlight> | |||
|- | |||
| List process tree || | |||
<syntaxhighlight lang="bash"> | |||
pstree 713 | |||
pstree $(ps -axo pid,command | awk 'match($2, /^login/) { print $1 }') | |||
</syntaxhighlight> | |||
|- | |||
| CPU & Memory || | |||
<syntaxhighlight lang="bash"> | |||
# Linux | |||
cat /proc/cpuinfo | cat /proc/cpuinfo | ||
cat /proc/meminfo | cat /proc/meminfo | ||
free | free | ||
sudo dmidecode --type 17,19,20 | |||
</syntaxhighlight> | |||
</ | |||
|- | |- | ||
| | | Locale || | ||
< | <syntaxhighlight lang="bash"> | ||
locale | locale # current locale | ||
locale -a # available locales | |||
sudo locale-gen # rebuild locales | |||
</syntaxhighlight> | |||
locale -a | |||
sudo locale-gen | |||
</ | |||
|- | |- | ||
| | | Run a command one minute later || | ||
< | <syntaxhighlight lang="bash"> | ||
echo "ls -l > `tty`" | at now + 1 minute | echo "ls -l > `tty`" | at now + 1 minute | ||
</ | </syntaxhighlight> | ||
|} | |} | ||
Latest revision as of 20:23, 3 April 2025
OS Management
123
TODO
| 情境 | 指令 |
|---|---|
| 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 |
pstree 713
pstree $(ps -axo pid,command | awk 'match($2, /^login/) { print $1 }')
|
| CPU & Memory |
# Linux
cat /proc/cpuinfo
cat /proc/meminfo
free
sudo dmidecode --type 17,19,20
|
| 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
|