SlideShare ist ein Scribd-Unternehmen logo
1 von 5
Downloaden Sie, um offline zu lesen
1




    HỆ ĐIỀU HÀNH LINUX
  (Lưu trữ và các lệnh khác)
Phạm Nguyên Khang, Đỗ Thanh Nghị
Email: pnkhang,dtnghi@cit.ctu.edu.vn
Nội dung
          2

find
tar
find
                                      3

Mục đích
Tìm kiếm file và thư mục
Cú pháp:
find <thư mục> <điều kiện> <lệnh>
Điều kiện
-name tên          có   tên là tên
-type x            có   kiểu là x
-user login-name   có   chủ sở hữu là login-name
-size n            có   kích thước là n khối
-mtime n           có   thời gian thay đổi n ngày trở về trước
Lệnh
-print             in kết quả ra màn hình
exec cmd {};      thực thi lệnh cmd
find
                                  4

Ví dụ:
find /home/pnkhang –name a.out –mtime +7 –exec rm {};
Tìm file có tên a.out trong thư mục /home/pnkhang hơn một tuần rồi
không được sửa đổi và xóa nó đi.
Có thể sử dụng ! (phủ định), -a (and), hoặc -o (or) để kết hợp
các điều kiện
Các điều kiện khác
-perm mode                quyền truy cập = mode
-maxdepth levels          độ sâu tối đa
-mindepth levels          độ sâu tối thiểu
Có thể kết hợp find với grep
find . | grep toto
tar
                                               5

Tape archive
Đóng gói file dùng để lưu trữ
Đóng gói tạo file lưu trữ
tar cvf luu_tru.tgz danh sách file/thư mục
Mở gói
tar xvf luu_tru.tgz
Có thể bỏ qua v trong cvf hoặc xvf
Thêm một tập tin vào gói
tar rvf luu_tru.tgz toto.txt
Liệt kê danh sách các file trong gói
tar tvf luu_tru.tgz
Thêm mới hoặc thay thế một file trong gói
tar uvf luu_tru.tgz toto.txt
Có thể nén/bung nén gói với gzip/gunzip
tar zcvf luu_tru.tgz danh sách file/thư mục
tar zxvf luu_tru.tgz

Weitere ähnliche Inhalte

Was ist angesagt?

5 quyen truy-xuat
5 quyen truy-xuat5 quyen truy-xuat
5 quyen truy-xuatvantinhkhuc
 
nhập xuất file 2 c++
nhập xuất file 2 c++nhập xuất file 2 c++
nhập xuất file 2 c++ptquang160492
 
Giao an tin hoc 11 - Tuan 11 - Bai 16 Vi du lam viec voi tep - v02 - vtq ngoc
Giao an tin hoc 11 - Tuan 11 - Bai 16 Vi du lam viec voi tep - v02 - vtq ngocGiao an tin hoc 11 - Tuan 11 - Bai 16 Vi du lam viec voi tep - v02 - vtq ngoc
Giao an tin hoc 11 - Tuan 11 - Bai 16 Vi du lam viec voi tep - v02 - vtq ngocNgoc Vu Thi Quynh
 
Phan quyen cent os
Phan quyen cent osPhan quyen cent os
Phan quyen cent osLy Phuong
 
Bai17 kieu du lieu tep va thao tac voi tep-tin 11
Bai17  kieu du lieu tep va thao tac voi tep-tin 11Bai17  kieu du lieu tep va thao tac voi tep-tin 11
Bai17 kieu du lieu tep va thao tac voi tep-tin 11Bich Tuyen
 
Chuong 03 he_thong_file
Chuong 03 he_thong_fileChuong 03 he_thong_file
Chuong 03 he_thong_filenguyenghia831
 
Linux và mã nguồn mở
Linux và mã nguồn mởLinux và mã nguồn mở
Linux và mã nguồn mởNguyễn Anh
 
Tpvthaotcvitp 111021042413-phpapp02
Tpvthaotcvitp 111021042413-phpapp02Tpvthaotcvitp 111021042413-phpapp02
Tpvthaotcvitp 111021042413-phpapp02huycuong29034
 
Giao an tin hoc 11 - Tuan 10 - Bai 14 - 15 Tep va thao tac voi tep - v04 - vt...
Giao an tin hoc 11 - Tuan 10 - Bai 14 - 15 Tep va thao tac voi tep - v04 - vt...Giao an tin hoc 11 - Tuan 10 - Bai 14 - 15 Tep va thao tac voi tep - v04 - vt...
Giao an tin hoc 11 - Tuan 10 - Bai 14 - 15 Tep va thao tac voi tep - v04 - vt...Ngoc Vu Thi Quynh
 
Inter process-pipe
 Inter process-pipe Inter process-pipe
Inter process-pipeNguynSang29
 
Command line in linux
Command line in linuxCommand line in linux
Command line in linuxNTCOM Ltd
 
Tin11 chuong 05 bai 15
Tin11 chuong 05 bai 15Tin11 chuong 05 bai 15
Tin11 chuong 05 bai 15Cam Tu Chau
 
Sinh vienit.net --01 - on tap xu ly file - c++-2
Sinh vienit.net --01 - on tap xu ly file - c++-2Sinh vienit.net --01 - on tap xu ly file - c++-2
Sinh vienit.net --01 - on tap xu ly file - c++-2Nhut Yen Dang
 
tài liệu Mã nguồn mở Lap trình shells
tài liệu Mã nguồn mở  Lap trình shellstài liệu Mã nguồn mở  Lap trình shells
tài liệu Mã nguồn mở Lap trình shellsThuyet Nguyen
 

Was ist angesagt? (18)

5 quyen truy-xuat
5 quyen truy-xuat5 quyen truy-xuat
5 quyen truy-xuat
 
Dsfont help
Dsfont helpDsfont help
Dsfont help
 
nhập xuất file 2 c++
nhập xuất file 2 c++nhập xuất file 2 c++
nhập xuất file 2 c++
 
Giao an tin hoc 11 - Tuan 11 - Bai 16 Vi du lam viec voi tep - v02 - vtq ngoc
Giao an tin hoc 11 - Tuan 11 - Bai 16 Vi du lam viec voi tep - v02 - vtq ngocGiao an tin hoc 11 - Tuan 11 - Bai 16 Vi du lam viec voi tep - v02 - vtq ngoc
Giao an tin hoc 11 - Tuan 11 - Bai 16 Vi du lam viec voi tep - v02 - vtq ngoc
 
Phan quyen cent os
Phan quyen cent osPhan quyen cent os
Phan quyen cent os
 
Bai17 kieu du lieu tep va thao tac voi tep-tin 11
Bai17  kieu du lieu tep va thao tac voi tep-tin 11Bai17  kieu du lieu tep va thao tac voi tep-tin 11
Bai17 kieu du lieu tep va thao tac voi tep-tin 11
 
Chuong 03 he_thong_file
Chuong 03 he_thong_fileChuong 03 he_thong_file
Chuong 03 he_thong_file
 
Linux và mã nguồn mở
Linux và mã nguồn mởLinux và mã nguồn mở
Linux và mã nguồn mở
 
Tpvthaotcvitp 111021042413-phpapp02
Tpvthaotcvitp 111021042413-phpapp02Tpvthaotcvitp 111021042413-phpapp02
Tpvthaotcvitp 111021042413-phpapp02
 
Giao an tin hoc 11 - Tuan 10 - Bai 14 - 15 Tep va thao tac voi tep - v04 - vt...
Giao an tin hoc 11 - Tuan 10 - Bai 14 - 15 Tep va thao tac voi tep - v04 - vt...Giao an tin hoc 11 - Tuan 10 - Bai 14 - 15 Tep va thao tac voi tep - v04 - vt...
Giao an tin hoc 11 - Tuan 10 - Bai 14 - 15 Tep va thao tac voi tep - v04 - vt...
 
Inter process-pipe
 Inter process-pipe Inter process-pipe
Inter process-pipe
 
Command line in linux
Command line in linuxCommand line in linux
Command line in linux
 
Cấu hình hệ thống
Cấu hình hệ thốngCấu hình hệ thống
Cấu hình hệ thống
 
Tin11 chuong 05 bai 15
Tin11 chuong 05 bai 15Tin11 chuong 05 bai 15
Tin11 chuong 05 bai 15
 
Sinh vienit.net --01 - on tap xu ly file - c++-2
Sinh vienit.net --01 - on tap xu ly file - c++-2Sinh vienit.net --01 - on tap xu ly file - c++-2
Sinh vienit.net --01 - on tap xu ly file - c++-2
 
Thuc hanh 13
Thuc hanh  13Thuc hanh  13
Thuc hanh 13
 
tài liệu Mã nguồn mở Lap trình shells
tài liệu Mã nguồn mở  Lap trình shellstài liệu Mã nguồn mở  Lap trình shells
tài liệu Mã nguồn mở Lap trình shells
 
Các lệnh shell cơ bản trong linux
Các lệnh shell cơ bản trong linuxCác lệnh shell cơ bản trong linux
Các lệnh shell cơ bản trong linux
 

Andere mochten auch

The live stages of special effects and the movies
The live stages of special effects and the moviesThe live stages of special effects and the movies
The live stages of special effects and the moviesIzzy Warren
 
Wvid2013 huongdan webinar
Wvid2013 huongdan webinarWvid2013 huongdan webinar
Wvid2013 huongdan webinarBân Pro
 
Security overview
Security overviewSecurity overview
Security overviewvantinhkhuc
 
Randi Zuckerberg at Landlord WEBCON 2014
Randi Zuckerberg at Landlord WEBCON 2014Randi Zuckerberg at Landlord WEBCON 2014
Randi Zuckerberg at Landlord WEBCON 2014LandlordWebCon
 
Teaching manual
Teaching manualTeaching manual
Teaching manualSano Anil
 
Summer conference sole
Summer conference   soleSummer conference   sole
Summer conference soleccantlie
 
Outsourcing your SharePoint Hosting: The Cloud's Fine Print Magnified
Outsourcing your SharePoint Hosting: The Cloud's Fine Print MagnifiedOutsourcing your SharePoint Hosting: The Cloud's Fine Print Magnified
Outsourcing your SharePoint Hosting: The Cloud's Fine Print MagnifiedSherWeb
 
Innovative work roshna work
Innovative work roshna workInnovative work roshna work
Innovative work roshna workSano Anil
 
Tablet Friendly Web Design - Best Practices for Financial Services
Tablet Friendly Web Design - Best Practices for Financial ServicesTablet Friendly Web Design - Best Practices for Financial Services
Tablet Friendly Web Design - Best Practices for Financial ServicesCorporate Insight
 
SACOSS conference june 2012
SACOSS conference june 2012SACOSS conference june 2012
SACOSS conference june 2012quandongpie
 
Innovative work.compressed
Innovative work.compressedInnovative work.compressed
Innovative work.compressedSano Anil
 

Andere mochten auch (20)

Ajax
AjaxAjax
Ajax
 
The live stages of special effects and the movies
The live stages of special effects and the moviesThe live stages of special effects and the movies
The live stages of special effects and the movies
 
Wvid2013 huongdan webinar
Wvid2013 huongdan webinarWvid2013 huongdan webinar
Wvid2013 huongdan webinar
 
Security overview
Security overviewSecurity overview
Security overview
 
Randi Zuckerberg at Landlord WEBCON 2014
Randi Zuckerberg at Landlord WEBCON 2014Randi Zuckerberg at Landlord WEBCON 2014
Randi Zuckerberg at Landlord WEBCON 2014
 
Mongo db
Mongo dbMongo db
Mongo db
 
Iphone sketches
Iphone sketchesIphone sketches
Iphone sketches
 
Teaching manual
Teaching manualTeaching manual
Teaching manual
 
Summer conference sole
Summer conference   soleSummer conference   sole
Summer conference sole
 
Innovative
InnovativeInnovative
Innovative
 
Data entry
Data entryData entry
Data entry
 
Outsourcing your SharePoint Hosting: The Cloud's Fine Print Magnified
Outsourcing your SharePoint Hosting: The Cloud's Fine Print MagnifiedOutsourcing your SharePoint Hosting: The Cloud's Fine Print Magnified
Outsourcing your SharePoint Hosting: The Cloud's Fine Print Magnified
 
The State- New College
The State- New CollegeThe State- New College
The State- New College
 
PPT_Feb_21_2016
PPT_Feb_21_2016PPT_Feb_21_2016
PPT_Feb_21_2016
 
Innovative work roshna work
Innovative work roshna workInnovative work roshna work
Innovative work roshna work
 
Tablet Friendly Web Design - Best Practices for Financial Services
Tablet Friendly Web Design - Best Practices for Financial ServicesTablet Friendly Web Design - Best Practices for Financial Services
Tablet Friendly Web Design - Best Practices for Financial Services
 
SACOSS conference june 2012
SACOSS conference june 2012SACOSS conference june 2012
SACOSS conference june 2012
 
8 filter
8 filter8 filter
8 filter
 
Innovative work.compressed
Innovative work.compressedInnovative work.compressed
Innovative work.compressed
 
Overflow
OverflowOverflow
Overflow
 

Ähnlich wie 10 back

Ähnlich wie 10 back (20)

Phân quyền trên file và thư mục trên Ubuntu
Phân quyền trên file và thư mục trên UbuntuPhân quyền trên file và thư mục trên Ubuntu
Phân quyền trên file và thư mục trên Ubuntu
 
5 quyen truy-xuat
5 quyen truy-xuat5 quyen truy-xuat
5 quyen truy-xuat
 
Linux+02
Linux+02Linux+02
Linux+02
 
Th linux
Th linuxTh linux
Th linux
 
Hdubuntu
HdubuntuHdubuntu
Hdubuntu
 
Làm thế nào để học linux trong 24h?
Làm thế nào để học linux trong 24h?Làm thế nào để học linux trong 24h?
Làm thế nào để học linux trong 24h?
 
Lesson 3 - Linux File System
Lesson 3 - Linux File SystemLesson 3 - Linux File System
Lesson 3 - Linux File System
 
04 02-2015 tep.ppt
04 02-2015 tep.ppt04 02-2015 tep.ppt
04 02-2015 tep.ppt
 
Project name
Project nameProject name
Project name
 
To ghi nho ubuntu
To ghi nho   ubuntuTo ghi nho   ubuntu
To ghi nho ubuntu
 
Carte ref-ubuntu-vi (1)
Carte ref-ubuntu-vi (1)Carte ref-ubuntu-vi (1)
Carte ref-ubuntu-vi (1)
 
Dang baitapthuchanh monhdh_unix
Dang baitapthuchanh monhdh_unixDang baitapthuchanh monhdh_unix
Dang baitapthuchanh monhdh_unix
 
Giao trinh PHP nang cao - Các hàm xử lý file trong PHP (CH003 Bài 2)
Giao trinh PHP nang cao - Các hàm xử lý file trong PHP (CH003 Bài 2)Giao trinh PHP nang cao - Các hàm xử lý file trong PHP (CH003 Bài 2)
Giao trinh PHP nang cao - Các hàm xử lý file trong PHP (CH003 Bài 2)
 
Linux04 hethongtaptin
Linux04 hethongtaptinLinux04 hethongtaptin
Linux04 hethongtaptin
 
Hệ thống tệp Linux
Hệ thống tệp LinuxHệ thống tệp Linux
Hệ thống tệp Linux
 
File
FileFile
File
 
Linux security
Linux securityLinux security
Linux security
 
Hệ điều hành (chương 4)
Hệ điều hành (chương 4)Hệ điều hành (chương 4)
Hệ điều hành (chương 4)
 
Tin11 chuong 05 bai 15
Tin11 chuong 05 bai 15Tin11 chuong 05 bai 15
Tin11 chuong 05 bai 15
 
Carte ref-ubuntu-vi
Carte ref-ubuntu-viCarte ref-ubuntu-vi
Carte ref-ubuntu-vi
 

Mehr von vantinhkhuc (20)

Url programming
Url programmingUrl programming
Url programming
 
Servlets intro
Servlets introServlets intro
Servlets intro
 
Servlet sessions
Servlet sessionsServlet sessions
Servlet sessions
 
Rmi
RmiRmi
Rmi
 
Md5
Md5Md5
Md5
 
Lecture17
Lecture17Lecture17
Lecture17
 
Lecture11 b
Lecture11 bLecture11 b
Lecture11 b
 
Lecture10
Lecture10Lecture10
Lecture10
 
Lecture9
Lecture9Lecture9
Lecture9
 
Lecture6
Lecture6Lecture6
Lecture6
 
Jsse
JsseJsse
Jsse
 
Jsf intro
Jsf introJsf intro
Jsf intro
 
Jsp examples
Jsp examplesJsp examples
Jsp examples
 
Jpa
JpaJpa
Jpa
 
Ejb examples
Ejb examplesEjb examples
Ejb examples
 
Corba
CorbaCorba
Corba
 
Ejb intro
Ejb introEjb intro
Ejb intro
 
Chc6b0c6a1ng 12
Chc6b0c6a1ng 12Chc6b0c6a1ng 12
Chc6b0c6a1ng 12
 
Ch06
Ch06Ch06
Ch06
 
Bai4
Bai4Bai4
Bai4
 

10 back

  • 1. 1 HỆ ĐIỀU HÀNH LINUX (Lưu trữ và các lệnh khác) Phạm Nguyên Khang, Đỗ Thanh Nghị Email: pnkhang,dtnghi@cit.ctu.edu.vn
  • 2. Nội dung 2 find tar
  • 3. find 3 Mục đích Tìm kiếm file và thư mục Cú pháp: find <thư mục> <điều kiện> <lệnh> Điều kiện -name tên có tên là tên -type x có kiểu là x -user login-name có chủ sở hữu là login-name -size n có kích thước là n khối -mtime n có thời gian thay đổi n ngày trở về trước Lệnh -print in kết quả ra màn hình exec cmd {}; thực thi lệnh cmd
  • 4. find 4 Ví dụ: find /home/pnkhang –name a.out –mtime +7 –exec rm {}; Tìm file có tên a.out trong thư mục /home/pnkhang hơn một tuần rồi không được sửa đổi và xóa nó đi. Có thể sử dụng ! (phủ định), -a (and), hoặc -o (or) để kết hợp các điều kiện Các điều kiện khác -perm mode quyền truy cập = mode -maxdepth levels độ sâu tối đa -mindepth levels độ sâu tối thiểu Có thể kết hợp find với grep find . | grep toto
  • 5. tar 5 Tape archive Đóng gói file dùng để lưu trữ Đóng gói tạo file lưu trữ tar cvf luu_tru.tgz danh sách file/thư mục Mở gói tar xvf luu_tru.tgz Có thể bỏ qua v trong cvf hoặc xvf Thêm một tập tin vào gói tar rvf luu_tru.tgz toto.txt Liệt kê danh sách các file trong gói tar tvf luu_tru.tgz Thêm mới hoặc thay thế một file trong gói tar uvf luu_tru.tgz toto.txt Có thể nén/bung nén gói với gzip/gunzip tar zcvf luu_tru.tgz danh sách file/thư mục tar zxvf luu_tru.tgz