แสดงเวลาว่าเครื่องเปิดมานานเท่าไหร่แล้ว (เฉพาะ Linux) ด้วย Python
การดูว่าเครื่องเปิดมานานเท่าไหร่แล้วบน Linux ปกติใช้คำสั่ง uptime แต่ถ้าต้องการเขียน script เพื่อรายงานเวลาว่าเครื่องเปิดมานานเท่าไหร่แล้ว สามารถใช้ Python เขียน Code ได้ดังนี้
คำสั่งต่างๆที่จำเป็น เช่น
df -h ดูการใช้พื้นที่ Harddisk
du -sh folder_name ดูการใช้พื้นที่ของแต่ละ folder
ที่มา: UsingTheTerminal, Basic Commands
ถ้าติดตั้ง Ubuntu เสร็จ แต่ Wireless ยังใช้ไม่ได้ให้ไปที่ System>Administration>Hardware Drivers
รอสักพักก็จะได้หน้าจอแสดง Driver มาให้เลือก โดยมี 2 อัน อันแรกคืออันที่ใช้อยู่ (ซึ่งใช้ไม่ได้) อันที่สองคืออันที่ยังไม่ได้ Activate เพราะไม่ใช่ Open Source ให้เลือกอันนี้ แล้วก็จะใช้ได้
ที่มา: WifiDocs Driver bcm43xx
แสดงรายระเอียดการ mount ที่เป็นอยู่
mount
ทำการ mount
mount /src /des
คำสั่ง Unzip บน Ubuntu
unzip <filename>.zip
ที่มา: FileCompression
Development Tools
There are many development tools available for Ubuntu. A list of some of these is included below.
ถ้าจะใช้ command ส่งเมลล์ ติดตั้ง Mail Transfer Agent ที่ชื่อ Postfix ก็พอ
https://help.ubuntu.com/11.04/serverguide/C/postfix.html
ที่มา: MailServer, Postfix
Postfix - using Telnet to test postfix
http://articles.slicehost.com/2008/8/6/postfix-using-telnet-to-test-postfix
Hostname
เรียกดู hostname
$ /bin/hostname
your_hostname
ตั้งชื่อ hostname ใหม่
$ /bin/hostname new_hostname
Ethernet
ดูและแก้ไข network interface ได้จากไฟล์ /etc/network/interfaces
เช่น
auto lo
iface lo inet loopback
address 127.0.0.1
netmask 255.0.0.0
auto eth0
iface eth0 inet dhcp
กำหนดคำสั่งที่จะเรียกใช้ (ในที่นี้คือ /home/user/command) ไว้ใน crontab ดังนี้
sudo crontab -e
@reboot /home/user/command
หรือจะพิมพ์คำสั่งไว้ใน text ไฟล์ แล้วใช้คำสั่ง crontab textfile ก็ได้
ที่มา: help.ubuntu.com/6.10/ubuntu/desktopguide/C/ch10s04.html