017643881952 vnnewgen@gmail.com

1.Cách copy 1 file hoặc folder qua ssh:

Trong cửa sổ Terminal gõ lệnh sau:

scp your_username@remotehost.edu:foobar.txt /local/dir

Trong đó

  1. your_username: tên đăng nhập ssh
  2. remotehost: địa chỉ server, host cần truy cập
  3. foobar.txt: đường dẫn file trên host
  4. /local/dir: thư mục bạn muốn lưu trên máy

Nếu muốn truy cập EC2 hoặc nếu dịch vụ khác yêu cầu sác thực với 1 private key, sử dụng -i option:

scp -i key_file.pem your_username@remotehost.edu:/remote/dir/foobar.txt /local/dir

2.Nén file hoặc thư mục dưới định dạng ZIP

Cài zip trên Ubuntu và Debian

sudo apt install zip

Zip tệp tin

zip archivename.zip filename1 filename2 filename3

Trong đó archivename.zip tên file nén sẽ được tạo ra

Zip thư mục

zip -r archivename.zip directory_name

Trong đó -r nghĩa là nén tât cả các thư mục con trong thư mục được nén.

Cũng có thể nén được nhiều thư mục hoặc nhiều file 1 lúc nếu muốn

zip -r archivename.zip directory_name1 directory_name2 file1 file1

Tham khảo thêm tại: https://linuxize.com/post/how-to-zip-files-and-directories-in-linux/

3. Giải nén file zipp

Nếu unzip chưa được cài đặt thì chạy lệnh sau

sudo apt-get install unzip

Sau khi cài đặt tiện ích giải nén, nếu bạn muốn giải nén vào một thư mục cụ thể, bạn có thể sử dụng:

unzip file.zip -d destination_folder

Nếu thư mục nguồn và thư mục đích giống nhau, bạn chỉ cần thực hiện:

unzip file.zip

4. Phân quyền truy cập file bằng lệnh chmod

Đang tiếp tục update 🙂