Tuesday, December 11, 2012

Linux Command


คำสั่ง             หน้าที่                               รายละเอียด
File/Directory Basics  
ls                      List files                                   แสดงรายชื่อไฟล์และไดเร็คทอรี่
cp                    Copy files                                 สำเนาไฟล์
mv                    Rename files                            เปลี่ยนชื่อไฟล์
rm                    Delete files                               ลบไฟล์
ln                     Link files                                  สร้างไฟล์เชื่อมโยง
cd                    Change directory                     ย้ายไปยังไดเร็คทอรี่ที่ต้องการ
pwd                  Print current directory name    แสดงชื่อไดเร็คทอรี่ปัจจุบัน
mkdir                Create directory                       สร้างไดเร็คทอรี่ใหม่
rmdir                Delete directory                       ลบไดเร็คทอรี่ (ที่ว่างเปล่าเท่านั้น)
File Viewing
cat                   View files                                  ดูเนื้อหาของ text file
less                  Page trough files                      เลื่อนดูเนื้อหาของไฟล์
head                View file beginning                   แสดงส่วนต้นของไฟล์
tail                    View files ending                      แสดงส่วนท้ายของไฟล์
nl                     Number lines                           แสดงหมายเลขบรรทัด
od                    View binary files                       แสดงเนื้อหาในไฟล์ไบนารี่
xxd                   View binary files                       แสดงเนื้อหาในไฟล์ไบนารี่
gv                     View Postscript/PDF files          แสดงไฟล์แบบโพสต์สคริปต์หรือ PDF
xdvi                  View TeX DVI files                     แสดงไฟล์รูปแบบ TeX
File Creation and Editing
emacs              Text editor                               โปรแกรมแก้ไขข้อความของ GNU
vim                   Text editor                               โปรแกรมแก้ไขข้อความที่ปรับปรุงจาก vi
umask              Set default file protections       แสดง/กำหนดค่าสำหรับคำนวณค่า permission mode
soffice              Edit Word/Excel/PowerPoint docs   แก้ไขไฟล์เอกสารWord/Excel/PowerPoint
abiword            Edit Word documents               แก้ไขเอกสาร Word
gnumeric         Edit Excel documents              แก้ไขเอกสาร Excel
File Properties
stat                  Display file attributes                แสดงสถานะ/สถิติ/คุณลักษณะของไฟล์
wc                    Count bytes/words/lines           นับจำนวนอักขระ คำ บรรทัด
du                    Measure disk usage                 แสดงปริมาณการใช้เนื้อที่ไดเร็คทอรี่
file                    Identify file types                      แสดงชนิดของไฟล์
touch               Change file timestamps           สร้างไฟล์เท็ค
chown              Change file owner                   เปลี่ยนชื่อเจ้าของไฟล์
chgrp               Change file group                    เปลี่ยนชื่อกรุ๊ปเจ้าของไฟล์
chmod             Change file protections           เปลี่ยนระดับการป้องกันไฟล์
chattr               Change advanced file attributes          เปลี่ยนคุณลักษณะของไฟล์ในขั้นสูง
Isattr                List advanced file attributes                 แสดงคุณลักษณะของไฟล์ในขั้นสูง

File Location
find                  Locate files                              ค้นหาตำแหน่งของไฟล์
slocate             Locate files via index               ค้นหาตำแหน่งของไฟล์ด้วยฐานข้อมูลดัชนี
which               Locate commands                   ค้นหาคำสั่ง
whereis            Locate standard files               ค้นหาไฟล์มาตรฐาน
File Text Manipulation
grep                 Search text for matching lines ค้นหาข้อความในระดับบรรทัด
cut                   Extract columns                       คัดแยกคำโดยระบุตำแหน่ง
paste               Append columns                      เชื่อมต่อไฟล์ในแนวระนาบ
tr                      Translate characters               แปลงข้อความ
sort                  Sort lines                                  จัดเรียงข้อความระดับบรรทัด
uniq                 Locate indentical lines             รวมบรรทัดที่เหมือนกัน
tee                   Copy stdin to file and to
stdout simultaneously              สำเนาข้อความออกทางไฟล์และ stdout พร้อมๆ กัน
File Compression
gzip                  Compress files (GNU Zip)        บีบอัดไฟล์ให้เป็น .gz
Compress        Compress files (Unix)              บีบอัดไฟล์แบบมาตรฐาน Unix
bzip2                Compress files (BZip2)                        บีบอัดไฟล์ให้เป็น .bz2
zip                    Compress files (Windows Zip)  บีบอัดไฟล์สำหรับ WinZip

File Comparison
diff                   Compare files line by line         เปรียบเทียบไฟล์ในระดับบรรทัด
comm.              Compare sorted files               เปรียบเทียบไฟล์ที่ผ่านการเรียงข้อมูลมาแล้ว
cmp                 Compare files byte by byte       เปรียบเทียบไฟล์ระดับไบต์
md5sum           Compute Checksums              คำนวณหาค่า md5 ของไฟล์
Disks and Filesystems
df                     Show free disk space              รายงานขนาดดิสก์ที่เหลืออยู่
mount              Make a disk accessible            เชื่อมต่ออุปกรณ์จัดเก็บข้อมูลเข้าสู่ระบบ
fsck                  Check a disk for errors                        ตรวจสอบแก้ไขความผิดปรกติของเนื้อที่ดิสก์
sync                 Flush disk caches                    เขียนข้อมูลในแคชกลับคืนสู่ดิสก์
Backups and Remote Storage
mt                    Control a type drive                  ควบคุมเทป
dump               Back up a disk                         สำรองข้อมูลจากดิสก์
restore             Restore a dump                       นำข้อมูลที่สำรองไว้กลับคืนที่เดิม
tar                    Read/write type archives          จัดเก็บไฟล์ให้รวมกันไว้ที่เดียว
cdrecord          Burn a CD                                เขียนไฟล์ลงสู่แผ่นซีดี
rsync                Mirror a set of files                   สำรองข้อมูลระหว่างโฮสต์



Printing
lpr                    Print files                                  ส่งไฟล์ไปพิมพ์ที่เครื่องพิมพ์
lpq                   View print queue                      เปิดดูลำดับงานพิมพ์ที่ค้างอยู่      
lprm                 Remove print jobs                    ยกเลิกงานพิมพ์ที่ค้างอยู่
Spelling Operations
look                  Look up spelling                      เปิดสารบัญคำศัพท์
aspell               Check spelling interactively     ตรวจคำสะกดว่าถูกต้องหรือไม่
spell                 Check spelling in batch           ตรวจคำถูกผิดในไฟล์จำนวนมาก
Processes
ps                    List all processes                     แสดงโปรเซสทั้งหมด
w                      List users' processes               แสดงรายชื่อยูสเซอร์ที่กำลังใช้งานโปรเซส
uptime              View the system load                แสดงปริมาณภาระของระบบ
top                   Monitor processes                   แสดงข้อมูลเกี่ยวกับโปรเซสแบบต่อเนื่อง
xload                Monitor system load                 แสดงภาระของระบบในแบบกราฟฟิก
free                  Display free memory                แสดงปริมาณหน่วยความจำประเภทต่างๆในปัจจุบัน
kill                   Terminate processes                    ส่งรหัสควบคุมไปยังโปรเซส
nice                 Set process priorities               ตั้งค่าระดับความสำคัญให้โปรเซส
renice              Change process priorities       ปรับระดับความสำคัญของโปรเซส


Scheduling Jobs
sleep                Wait for some time                   หน่วงเวลา
watch               Run programs at set intervals  รันโปรแกรมซ้ำในระยะเวลาที่กำหนด
at                     Schedule a job                         ตั้งเวลารันกลุ่มคำสั่ง
crontab            Schedule repeated jobs           ตั้งเวลารันคำสั่งเป็นรอบเวลาที่กำหนด
Hosts
uname             Print system information           แสดงรายละเอียดของระบบปฏิบัติการ
hostname         Print the system's hostname    แสดง/กำหนดชื่อโฮสต์
ifconfig             Set/display network information           แสดง/กำหนดค่าเกี่ยวกับเครือข่าย
host                 Look up DNS                           สืบค้นชื่อและไอพีของโฮสต์ในระบบ DNS
whois               Lookup domain registrants      สืบค้นข้อมูลการจดทะเบียนโดเมน
ping                 Check if host is reachable       ทดสอบการตอบสนองของโฮสต์ปลายทาง
traceroute        View network path to a host     ตรวจสอบเส้นทางไปสู่โฮสต์ปลายทาง
Networking
Ssh                  Securely log into remote hosts เข้าสู่โฮสต์จากระยะไกล (มีการเข้ารหัสข้อมูล)
telnet               Log into remote hosts              เข้าสู่โฮสต์จากระยะไกล(ไม่มีการเข้ารหัส)
scp                  Securely copy files between hosts       สำเนาไฟล์ระหว่างโฮสต์(มีการเข้ารหัสข้อมูล)
stfp                  Securely copy files between hosts       บริการโอนถ่ายไฟล์ระหว่างโฮสต์(มีการเข้ารหัส  ข้อมูล) 
ftp                    Copy files between hosts         บริการโอนถ่ายไฟล์ระหว่างโฮสต์(ไม่มีการเข้ารหัสข้อมูล)
evolution          GUI email client                       โปรแกรมใช้งานอีเมล์แบบกราฟฟิก
mutt                 Text-based email client            โปรแกรมใช้งานอีเมล์แบบ text
mail                  Minimal email client                  คำสั่งรับส่งอีเมล์ขนาดเล็กมาก
mozilla             Web browser                           โปรแกรมเว็บบราวเซอร์แบบกราฟฟิก
lynx                  Text-only web browser             โปรแกรมเว็บบราวเซอร์แบบ text
wget                 Retrieve web pages to disk      ดาวน์โหลดข้อมูลเว็บมาสู่ดิสก์
slrn                  Read Usenet news                  อ่านข่าวใน usenet
gaim                 Instant messaging/IRC             โปรแกรมรับส่งข้อความ
talk                   Linux/Unix chat                        คำสั่งรับส่งข้อความโต้ตอบ
write                 Send messages to a termainal คำสั่งส่งข้อความไปยังจอภาพอื่น
mesg                Prohibit talk/write                     เปิด/ปิดการรับข้อความจากคำสั่ง write
Audio and Video
grip                  Play CDs and rip MP3s เล่นแผ่นซีดีเพลงและแปลงเป็นไฟล์ MP3
xmms               Play audio files                         เล่นไฟล์เสียงชนิดต่างๆ
cdparanoia      Rip audioแปลง                         แทร็กเพลงให้เป็นไฟล์
audacity           Edit audio                                 ปรับแต่ง/แก้ไขไฟล์เสียง
xcdroast          Burn CDs                                 บันทึกข้อมูล/แทร็กเสียงลงแผ่นซีดี

คำสั่งสำหรับตรวจสอบ Default DNS


คำสั่งสำหรับตรวจสอบ Default DNS

#nslookup
>server



คำสั่ง hostname สำหรับการตรวจสอบ Hostname


คำสั่ง hostname สำหรับการตรวจสอบ Hostname

#hostname


คำสั่ง uname สำหรับการตรวจสอบ kernel (version)


คำสั่ง uname สำหรับการตรวจสอบ kernel (version)

#uname -a
#uname -i





คำสั่ง netstat


คำสั่ง netstat -in สำหรับการตรวจสอบข้อมูลประจำเครือข่าย

#netstat -in


คำสั่ง netstat -rn สำหรับการตรวจสอบ Default Gateway

#netstat -rn

คำสั่ง ping สำหรับตรวจสอบเส้นทางเครือข่าย

คำสั่ง ping สำหรับตรวจสอบเส้นทางเครือข่าย

#ping 202.29.32.10
#ping www.yru.ac.th
#ping -c5 202.29.32.1 >/root/test_ping


คำสั่ง ps ตรวจสอบสถานะของโปรเซส

คำสั่ง ps ตรวจสอบสถานะของโปรเซส

#ps ax | more
#ps ax | grep usb