Làm cách nào để đặt nhiều tệp vào nhiều thư mục trong Linux?
Ngày đăng:
16/01/2023
Trả lời:
0
Lượt xem:
124
Để kết hợp nhiều tệp thành một tệp lưu trữ duy nhất (ví dụ: tar -cvf my_files.tar /path/to/my/directory6), hãy sử dụng lệnh sau (thay thế tar -cvf my_files.tar /path/to/my/directory7 và tar -cvf my_files.tar /path/to/my/directory8 bằng tên của các tệp bạn muốn kết hợp) Show tar -cvf my_files.tar file1 file2 Để kết hợp tất cả các tệp trong một thư mục thành một tệp lưu trữ duy nhất (ví dụ: tar -cvf my_files.tar /path/to/my/directory6), hãy sử dụng lệnh sau (thay thế tar -cvzf my_files.tar.gz file1 file20 bằng đường dẫn tuyệt đối đến thư mục chứa các tệp bạn muốn kết hợp) tar -cvf my_files.tar /path/to/my/directory Ghi chú
Tạo một tệp lưu trữ nénNhiều bản phân phối Linux sử dụng GNU tar -cvf my_files.tar /path/to/my/directory2, một phiên bản của tar -cvf my_files.tar /path/to/my/directory2 do Tổ chức Phần mềm Tự do< . Nếu hệ thống của bạn sử dụng GNU tar -cvf my_files.tar /path/to/my/directory2, bạn có thể sử dụng tar -cvf my_files.tar /path/to/my/directory2 kết hợp với tiện ích nén tệp tar -cvf my_files.tar /path/to/my/directory4 để kết hợp nhiều tệp vào một tệp lưu trữ nén. . If your system uses GNU tar -cvf my_files.tar /path/to/my/directory2, you can use tar -cvf my_files.tar /path/to/my/directory2 in conjunction with the tar -cvf my_files.tar /path/to/my/directory4 file compression utility to combine multiple files into a compressed archive file. Ví dụ
Ghi chú
Nếu hệ thống của bạn không sử dụng GNU tar -cvf my_files.tar /path/to/my/directory2, nhưng vẫn có tar -cvf my_files.tar /path/to/my/directory4, bạn có thể tạo một tệp lưu trữ tar -cvf my_files.tar /path/to/my/directory2 được nén (ví dụ: tar -cvzf my_files.tar.gz /path/to/my/directory4 bằng lệnh sau (thay thế tar -cvf my_files.tar /path/to/my/directory7 và tar -cvf my_files.tar /path/to/my/directory8 bằng tên của các tệp bạn muốn kết hợp) tar -cvf - file1 file2 | gzip > my_files.tar.gz Nếu tar -cvf my_files.tar /path/to/my/directory4 không có sẵn trên hệ thống của bạn, bạn có thể sử dụng tiện ích tar -cvf my_files.tar /path/to/my/directory5 để tạo một kho lưu trữ nén (ví dụ: tar -cvf - file1 file2 | compress > my_files.tar.Z6); tar -cvf - file1 file2 | compress > my_files.tar.Z Trích xuất nội dung của một tệp lưu trữĐể trích xuất nội dung của tệp lưu trữ tar -cvf my_files.tar /path/to/my/directory2 được tạo bởi tar -cvf my_files.tar /path/to/my/directory2 (ví dụ: tar -cvf my_files.tar /path/to/my/directory6), hãy sử dụng lệnh sau tar -xvf my_files.tar Để trích xuất nội dung của tệp lưu trữ tar -cvf my_files.tar /path/to/my/directory2 được nén bằng tar -cvf my_files.tar /path/to/my/directory4 (ví dụ: tar -cvzf my_files.tar.gz /path/to/my/directory4), hãy sử dụng lệnh sau tar -xvzf my_files.tar.gz Nếu bạn không sử dụng GNU tar -cvf my_files.tar /path/to/my/directory2 và cần trích xuất nội dung của tệp lưu trữ tar -cvf my_files.tar /path/to/my/directory2 được nén bằng tar -cvf my_files.tar /path/to/my/directory4 (ví dụ: tar -cvzf my_files.tar.gz /path/to/my/directory4), hãy sử dụng lệnh sau gunzip -c my_files.tar.gz | tar -xvf - Để trích xuất nội dung của tệp lưu trữ tar -cvf my_files.tar /path/to/my/directory2 được nén bằng tar -cvf my_files.tar /path/to/my/directory5 (ví dụ: tar -cvf - file1 file2 | compress > my_files.tar.Z6), hãy sử dụng lệnh sau uncompress -c my_files.tar.Z | tar -xvf - Thông tin thêmKhi sử dụng lệnh tar -cvf my_files.tar /path/to/my/directory2, thứ tự của các tùy chọn đôi khi có vấn đề. Ví dụ: một số phiên bản của tar -cvf my_files.tar /path/to/my/directory2 (không phải GNU tar -cvf my_files.tar /path/to/my/directory2) yêu cầu tùy chọn tar -cvzf my_files.tar.gz file1 file23 ngay sau đó là khoảng trắng và tên của tệp lưu trữ tar -cvf my_files.tar /path/to/my/directory2 Lệnh tar -cvf my_files.tar /path/to/my/directory2 có sẵn nhiều tùy chọn. Để biết chi tiết, hãy tham khảo trang hướng dẫn tar -cvf my_files.tar /path/to/my/directory2; tar -cvf my_files.tar /path/to/my/directory0 GNU tar -cvf my_files.tar /path/to/my/directory2 đi kèm với tài liệu bổ sung, bao gồm hướng dẫn, có thể truy cập thông qua giao diện Thông tin GNU. Bạn có thể truy cập tài liệu này bằng cách nhập tar -cvf my_files.tar /path/to/my/directory1 Trong giao diện Thông tin, nhấn gunzip -c my_files.tar.gz | tar -xvf -0 (dấu chấm hỏi) để xem danh sách các lệnh Tại Đại học Indiana, để được hỗ trợ hệ thống Linux hoặc Unix cá nhân hoặc bộ phận, hãy xem Nhận trợ giúp về Linux hoặc Unix tại IU Tài liệu liên quanVề. Phần mở rộng tệp Z Tận dụng tốt hơn không gian đĩa của bạn trong Unix Giới thiệu về tệp nén trong Unix Kết hợp nhiều tệp văn bản thành một tệp duy nhất trong Unix Làm cách nào để di chuyển nhiều tệp trong các thư mục khác nhau cùng một lúc trong Linux?Để di chuyển nhiều tệp bằng lệnh mv chuyển tên tệp hoặc mẫu theo sau là đích . Ví dụ sau giống như trên nhưng sử dụng khớp mẫu để di chuyển tất cả các tệp bằng. phần mở rộng txt.
Bạn có thể tạo đồng thời nhiều tệp bằng lệnh mkdir không?lệnh mkdir trong Linux cho phép người dùng tạo thư mục (còn được gọi là thư mục trong một số hệ điều hành). Lệnh này có thể tạo nhiều thư mục cùng lúc cũng như đặt quyền cho các thư mục. |