Print
Category: Ubuntu Linux
Hits: 607

ซื้อสินค้า VoIP คลิกไปที่ https://www.lazada.co.th/shop/adventek/

1. Files

================================

ค้นหาไฟล์ที่เพิ่งแก้ไขเมื่อ n นาที ที่ผ่านมา

$sudo find <directory> -mmin -<n> -type f

เช่น $sudo find . -mmin -5 -type f

================================

แสดงแถวที่ n (, คั่นระหว่างแถว)

$sudo col<n> "<separator>" <filename>

เช่น $sudo col2 "," foo.csv

================================

แสดงไฟล์

$sudo less <filename>

================================

แสดง n บรรทัดแรก

$sudo head -n <n> <filename>

================================

แสดง n บรรทัดสุดท้าย

$sudo tail -n <n> <filename>

================================

แสดงข้อความที่เพิ่มขึ้น

$sudo tail -f <filename>

================================

บีบอัดไฟล์ใน directory แล้วแพ็คเป็นไฟล์เดียว

$sudo zip -r <target> <source dir>

$sudo tar cvzf <target>.tar.gz <source dir>

================================

คลายไฟล์

$sudo unzip <zip file>

$sudo tar xf <tar.gz file>

================================

copy ไฟล์ไปยัง remote server

$sudo scp <filename> <user@server>:<destination>

เช่น $sudo scp config.yaml This email address is being protected from spambots. You need JavaScript enabled to view it.:/config

================================

copy ไฟล์ทั้งหมดใน directory จาก remote server มายัง local directory

$sudo scp -r <user@server>:<source> <destination>

เช่น $sudo scp -r This email address is being protected from spambots. You need JavaScript enabled to view it.:/config /tmp

 

2. System

================================

แสดง kernel version

$uname -r

================================

แสดง disk usage

$df -h

================================

แสดง memory usage

$cat /proc/meminfo

================================

แสดง system time

$timedatectl status

================================

กำหนด system timezone

$timedatectl list-timezones

$sudo timedatectl set-timezone <zone>

================================

แสดง services ที่ทำงานอยู่

$systemctl --state running

================================

start หรือ stop service

$service <service> start/stop

================================

ดู log ที่กำลังเกิดขึ้น ของ service 

$journalctl -u <service> --since now -f

================================

ดู processes ที่กำลังทำงานอยู่

$htop

================================

หยุด process โดยระบุ process id

$kill <process id>

================================

หยุด process โดยระบุ process name

$pkill <process name>

================================

run command background

<command> &

================================

แสดง background commands 

$jobs

================================

ดึง command จาก background เป็น foreground

$fg <n>