sudo ifconfig eth0 down (shuts down the eth0 interface, releases the IP)
sudo ifconfig eth0 up (enables the eth0 interface, renews the IP)
sudo /etc/init.d/networking restart
Ref: http://www.pcmech.com/article/releasing-and-renewing-your-ip-address-in-ubuntu/
$ time ls
real 0m0.005s
user 0m0.004s
sys 0m0.000s
* The elapsed (real) time between invocation of utility and its
termination.
* The User CPU time, equivalent to the sum of the tms_utime and
tms_cutime fields returned by the times() function defined in the
System Interfaces volume of IEEE Std 1003.1-2001 for the process in
which utility is executed.
คำสั่งต่างๆที่จำเป็น เช่น
df -h ดูการใช้พื้นที่ Harddisk
du -sh folder_name ดูการใช้พื้นที่ของแต่ละ folder
ที่มา: UsingTheTerminal, Basic Commands
แสดงรายระเอียดการ mount ที่เป็นอยู่
mount
ทำการ mount
mount /src /des
คำสั่ง Unzip บน Ubuntu
unzip <filename>.zip
ที่มา: FileCompression
การให้สิทธิใน MySQL ใช้คำสั่ง Grant เช่น
grant all on *.* to jack@localhost identified by 'xxxx';
เป็นการให้สิทธิทั้งหมดแก่ user jack@localhost
แต่ถ้าต้องการให้สิทธิบางส่วนเช่น ให้สิทธิเฉพาะฐานข้อมูลที่กำหนดให้ใช้ึคำสั่ง
grant all on mydb.* to jack@localhost identified by 'xxxx';
ที่มา: GRANT Syntax
กำหนดคำสั่งที่จะเรียกใช้ (ในที่นี้คือ /home/user/command) ไว้ใน crontab ดังนี้
sudo crontab -e
@reboot /home/user/command
หรือจะพิมพ์คำสั่งไว้ใน text ไฟล์ แล้วใช้คำสั่ง crontab textfile ก็ได้
ที่มา: help.ubuntu.com/6.10/ubuntu/desktopguide/C/ch10s04.html
คำสั่ง Backup Database
คำสั่ง Backup Table
ที่มา: dev.mysql.com
ตัวอย่างไฟล์งานชื่อ test
วิธีรวมเป็นไฟล์เดียว
tar -cvf test.tar test
ผลลัพธ์จะได้ไฟล์ test.tar
วิธี zip
gzip test.tar
ผลลัพธ์จะได้ไฟล์ test.tar.gz
วิธี unzip
tar -zxvf test.tar.gz
ผลลัพธ์จะได้ไฟล์ test
อ้างอิง expert2you.com
ฐานข้อมูลสามารถสร้างได้ด้วยการพิมพ์คำสั่งทาง command line ดังนี้
sudo mysqladmin -u username -p create databasename