Useful Commands/System Management: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
(→TODO) |
||
| (One intermediate revision by the same user not shown) | |||
| Line 1: | Line 1: | ||
== OS Management == | |||
123 | |||
== TODO == | |||
{| class="wikitable" | {| class="wikitable" | ||
! 情境 || 指令 | ! 情境 || 指令 | ||
|- | |- | ||
| List process || | | List process || | ||
< | <syntaxhighlight lang="bash"> | ||
ps -axo pid,command | ps -axo pid,command | ||
ps -axo pid,command | awk 'match($2, /^ssh/) { print $0; }' | 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, /^login/) { print $0; }' | ||
ps -axo pid,command | awk 'match($2, /^-?bash/) { print $0; }' | ps -axo pid,command | awk 'match($2, /^-?bash/) { print $0; }' | ||
</ | </syntaxhighlight> | ||
|- | |- | ||
| List process tree || | | List process tree || | ||
< | <syntaxhighlight lang="bash"> | ||
pstree 713 | pstree 713 | ||
pstree $(ps -axo pid,command | awk 'match($2, /^login/) { print $1 }') | pstree $(ps -axo pid,command | awk 'match($2, /^login/) { print $1 }') | ||
</ | </syntaxhighlight> | ||
|- | |- | ||
| CPU & Memory || | | CPU & Memory || | ||
< | <syntaxhighlight lang="bash"> | ||
# Linux | # Linux | ||
cat /proc/cpuinfo | cat /proc/cpuinfo | ||
| Line 23: | Line 29: | ||
free | free | ||
sudo dmidecode --type 17,19,20 | sudo dmidecode --type 17,19,20 | ||
</ | </syntaxhighlight> | ||
|- | |- | ||
| Locale || | | Locale || | ||
< | <syntaxhighlight lang="bash"> | ||
locale # current locale | locale # current locale | ||
locale -a # available locales | locale -a # available locales | ||
sudo locale-gen # rebuild locales | sudo locale-gen # rebuild locales | ||
</ | </syntaxhighlight> | ||
|- | |- | ||
| Run a command one minute later || | | 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
|