For the complete documentation index, see llms.txt. This page is also available as Markdown.

SysAdmin Commands

User identification and who is who in Linux world

คำสั่ง
คำอธิบาย

hostname

แสดงชื่อเครื่อง

whoami

ชื่อ username ที่ login เข้าระบบ ณ ขณะนี้

w

แสดงรายชื่อ user ที่กำลังเข้าใช้ในระบบ ระยะเวลาที่เข้าสู่ระบบ .

last

แสดงรายชื่อ user ที่เข้าสู่ระบบที่ผ่านมา

last root

แสดงข้อมูลว่า root user เข้าสู่ระบบล่าสุด

lastb

แสดงรายชื่อ user ที่พยายามเข้าสู่ระบบ แต่ไม่สำเร็จ

ตรวจสอบรายละเอียด Hardware ของเครื่อง

// report exact memory configuration, firmware version, mainboard configuration, 
CPU version and speed, cache configuration, bus speed, etc.
$ sudo lshw | less 
$ sudo lshw -html > myhardware.html 
$ sudo lshw -xml > myhardware.xml 


$ sudo dmidecode -q | less # To display BIOS information
$ sudo slusb -tv # To see USB info


$ sudo smartctl -A /dev/sda | grep Power_On_Hours # How long has this disk (system) been powered on in total
$ sudo hdparm -tT /dev/sda # Do a read speed test on disk sda
$ sudo badblocks -s /dev/sda # Test for unreadable blocks on disk sda

การอ่านสถานะของทรัพยากรระบบจากไดเรกทอรี /proc

ไดเรกทอรี /proc เปรียบเสมือนหน้าต่างของลีนุกซ์คอร์เนล (Kernel Windows) ซึ่งเป็นไดเรกทอรีพิเศษที่เป็นระบบไฟล์เสมือน (virtual filesystem) ที่สามารถเข้าถึงสถานะการทำงานของอุปกรณ์ในระดับฮาร์ดแวร์ของเครื่อง และสถานะข้อมูลต่างๆของระบบโดยค่าทั้งหมดจะถูกเก็บอยู่ในหน่วยความจำ

เมื่อใช้คำสั่ง ls /proc จะพบกลุ่มของไฟล์จำนวนมาก รวมทั้งไดเรกทอรีที่เป็นตัวเลข ซึ่งไดเรกทอรีเหล่านี้คือสถานที่เก็บข้อมูลของระบบที่กำลังทำงานอยู่และถูกจะอ้างอิงจากหมายเลขโปรเซสนั่นเอง นอกจากนั้นแล้วในไดเรกทอรี /proc ยังมีไฟล์พิเศษที่แทนฮาร์แวร์ต่างๆในระบบ ได้แก่

ไฟล์
คำอธิบาย

/proc/modules

dynamically loaded modules

/proc/devices

registered character and block major numbers

/proc/iomem

on-system physical RAM and bus device addresses

/proc/ioports

on-system I/O port addresses (especially for x86 systems)

/proc/interrupts

registered interrupt request numbers

/proc/softirqs

registered soft IRQs

/proc/kallsyms

running kernel symbols, including from loaded modules

/proc/partitions

currently connected block devices and their partitions

/proc/filesystems

currently active filesystem drivers

/proc/swaps

currently active swaps

/proc/cpuinfo

information about the CPU(s) on the system

/proc/meminfo

information about the memory on the system, viz., RAM, swap

โปรแกรมเสริมการดูทรัพยากรสำคัญภายในเครื่อง

Last updated

Was this helpful?