• About Us
  • Contact
  • Trang chủ
  • Code
  • Linux
  • Virtualization
  • Mail
No Result
View All Result
System Zone
No Result
View All Result
Home Linux

Các command Linux cần thiết cho IT

admin by admin
12 Tháng 1, 2022
in Linux
0

Warning: Division by zero in /www/wwwroot/systemzone.top/wp-content/themes/jnews/class/Image/ImageBackgroundLoad.php on line 105
0
SHARES
0
VIEWS
Share on FacebookShare on Twitter

Linux thì có rất nhiều loại như Ubuntu, Redhat, Debian,… Nhưng hôm nay mình sẽ làm một vài câu lệnh cần thiết và thường gặp trên CentOS 7. Những câu lệnh này sẽ thường gặp cho các bạn làm IT quản trị hệ thống trong việc fix lỗi.

Related Posts

Hướng dẫn cài đặt MongoDB 5 trên centos 7

Hướng dẫn resize ổ cứng bằng Gparted trên centos 7

Fix error: kernel: nf_conntrack: table full, dropping packet

Cấu hình IP tĩnh trên ubuntu 20.04

1. Check Version của Linux

cat /etc/os-release

Hoặc nếu bạn đang không biết nó đang là hệ điều hành nào thì có thể sử dụng cách này

cat /etc/*-release

2. Hiển thị các phiên bản kernel của Linux

#hostnamectl

Kết quả: 
  Static hostname: centos2
         Icon name: computer-vm
           Chassis: vm
        Machine ID: 804f60cc25a848acaeca1da37f7dbecd
           Boot ID: 5afe786c1fdc44ffacd9b54b0130735f
    Virtualization: vmware
  Operating System: CentOS Linux 7 (Core)
       CPE OS Name: cpe:/o:centos:centos:7
            Kernel: Linux 3.10.0-1160.49.1.el7.x86_64
      Architecture: x86-64

3. Check thông tin máy chủ

cat /proc/cpuinfo

Kết quả:
processor       : 0
vendor_id       : GenuineIntel
cpu family      : 6
model           : 42
model name      : Intel(R) Core(TM) i3-2367M CPU @ 1.40GHz
stepping        : 7
microcode       : 0x2f
cpu MHz         : 1396.829
cache size      : 3072 KB
physical id     : 0
siblings        : 1
core id         : 0
cpu cores       : 1
apicid          : 0
initial apicid  : 0
fpu             : yes
fpu_exception   : yes
cpuid level     : 13
wp              : yes
flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ss syscall nx rdtscp lm constant_tsc arch_perfmon nopl xtopology tsc_reliable nonstop_tsc eagerfpu pni pclmulqdq ssse3 cx16 pcid sse4_1 sse4_2 x2apic popcnt tsc_deadline_timer xsave avx hypervisor lahf_lm ssbd ibrs ibpb stibp tsc_adjust arat md_clear spec_ctrl intel_stibp flush_l1d arch_capabilities
bogomips        : 2793.65
clflush size    : 64
cache_alignment : 64
address sizes   : 45 bits physical, 48 bits virtual
power management:

processor       : 1
vendor_id       : GenuineIntel
cpu family      : 6
model           : 42
model name      : Intel(R) Core(TM) i3-2367M CPU @ 1.40GHz
stepping        : 7
microcode       : 0x2f
cpu MHz         : 1396.829
cache size      : 3072 KB
physical id     : 2
siblings        : 1
core id         : 0
cpu cores       : 1
apicid          : 2
initial apicid  : 2
fpu             : yes
fpu_exception   : yes
cpuid level     : 13
wp              : yes
flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ss syscall nx rdtscp lm constant_tsc arch_perfmon nopl xtopology tsc_reliable nonstop_tsc eagerfpu pni pclmulqdq ssse3 cx16 pcid sse4_1 sse4_2 x2apic popcnt tsc_deadline_timer xsave avx hypervisor lahf_lm ssbd ibrs ibpb stibp tsc_adjust arat md_clear spec_ctrl intel_stibp flush_l1d arch_capabilities
bogomips        : 2793.65
clflush size    : 64
cache_alignment : 64
address sizes   : 45 bits physical, 48 bits virtual
power management:

4. Check RAM

Với lệnh check RAM thì nếu bạn check đơn giản thì dùng lệnh

free -m

Còn với những bạn yêu cầu check phức tạp hơn thì dùng lệnh

cat /proc/meminfo

5. Các lệnh restart, shutdown

# lệnh shutdown
init 0

#lệnh restart
init 6

6. Lệnh check ổ cứng

# df -h

Có thể tìm hiểu thêm bằng lệnh
# df --help

7. Lệnh tìm kiếm

Nếu bạn muốn tìm kiếm tất cả các file có phần mở rộng là .txt

 find /home -name  *.txt
Trong đó:
find là lệnh tìm kiếm
/home là thư mục ta muốn tìm kiếm
-name gọi tên file cần tìm
*.txt là phần đuôi mở rộng có thể thay đổi

Còn nếu bạn muốn tìm kiếm các file rỗng

find /tmp -type f -empty
Trong đó:
Find là lệnh tìm kiếm
/tmp là thư mục tìm kiếm trong nó
-type là thể loại
-empty là rỗng

Ngoài ra còn có các lệnh tìm kiếm khác khá hay (nâng cao)

Tìm kiếm file được chỉnh sửa trong vòng 50 ngày
# find / -mtime 50

Tìm kiếm file được chỉnh sửa trong vòng 50 - 100 ngày
# find / -mtime +50 –mtime -100

Tìm kiếm file vừa được tạo ra trong vòng 1 giờ
# find / -cmin -60

Lệnh này dùng đễ check nhanh tình trạng chiếm dung lượng trong thư mục

Tìm kiếm 1 file dung lượng lớn nhất trong thư mục
# du -h /etc | sort -n -r | head -n 10

Với trường hợp file ít thì có thể show tất cả file lớn nhỏ ra đễ xem
# du -h

Tìm kiếm dung lượng từng thư mục
# du -h --max-depth=1 /etc

8. Lệnh Copy

Với copy thì ta dùng lệnh cp

Copy từ 1 file A sang file B nhưng vẫn giữ được file A
# cp A.txt B.txt

Copy nhiều file vào 1 thư mục
# cp A.txt B.txt C.txt D.exe E.exe ./lab

Copy file từ 1 thư mục khác sang thư mục mới
# cp /root/report.xlsx /home/
Trong đó: report.xlsx là file cần copy
          /home là thư mục copy file vào

Ngoài ra các bạn có thể tự học và phân tích câu lệnh với trang web: https://explainshell.com/

 

Tags: Các command Linux cần thiếtCác command Linux cần thiết cho ITcommand Linuxcommand Linux cần thiếtcommand Linux cho IT
Next Post

Cài đặt CSF trên Directadmin

0 0 đánh giá
Đánh giá bài viết
Theo dõi
Đăng nhập
Thông báo của
guest

guest

0 Góp ý
Cũ nhất
Mới nhất Được bỏ phiếu nhiều nhất
Phản hồi nội tuyến
Xem tất cả bình luận

© 2025 SystemZone - Premium WordPress news & magazine theme by Aitemat.

No Result
View All Result
  • About Us
  • About Us
  • blog
  • Campaign
  • Cart
  • Checkout
  • Giới thiệu
  • Home 2
  • IT STORY
  • Lập trình web
  • Learning More
  • Linux Administrator
  • Mail
  • My account
    • Wishlist
  • Privacy Policy
  • Sample Page
  • Track your order
  • Trang chủ
  • Trang Mẫu
  • Virtualization
  • Sections
  • Rows / Columns
  • Sliders
  • Buttons
  • Titles / Dividers
  • Blog Posts
  • Mega Shop
  • Simple Slider
  • Banner Grids
  • Icon Box
  • Lightbox
  • Scroll To
  • Pages
    • About
    • Contact
    • FAQ
    • Portfolio
  • Map
  • Message box
  • Product Categories
  • Products
  • Share / follow icons
  • Tabs
  • Team Member
  • Testimonials

© 2025 SystemZone - Premium WordPress news & magazine theme by Aitemat.

wpDiscuz