W4 (2023/10/03)
NFS
NFS Network File System
在Server端有個 /data ,export /data 後,Client端mount Server端export出來的資料夾/檔案 ,之後在兩端編輯都能看見修改的內容。(資料的存放是在Server端)
CentOS 7 下 yum 安装和配置 NFS
Image Not Showing
Possible Reasons
- The image was uploaded to a note which you don't have access to
- The note which the image was originally uploaded to has been deleted
Learn More →
-
Server端
安裝:
sudo yum install nfs-utils
sudo systemctl enable rpcbind
sudo systemctl enable nfs
getenforce 跟 firewall 先關閉
配置共享目錄、目標:
sudo vim /etc/exports
在這裡新增要共享的資料夾跟權限等
/data/ 192.168.68.0/24(rw,sync,no_root_squash,no_all_squash)
* /data/
為共享的目錄
* 192.168.68.0/24
Client IP範圍
* rw
讀寫權限
* sync
同步目錄
* no_root_squash
可以使用root授權
* no_all_squash
可以使用普通用戶授權
儲存後重啟 NFS:
sudo systemctl restart nfs
查看共享目錄:
-
Client端
安裝:
sudo yum install nfs-utils
sudo systemctl enable rpcbind
sudo systemctl enable nfs
查看Server端共享的目錄:
建立連結的目錄(名稱可以不一樣):
mkdir /nfs-data -p
掛載:
mount -t nfs 192.168.68.131:/data /nfs-data
* -t nfs
檔案格式 nfs
* 192.168.68.131
掛載的主機IP
* :/data /nfs-data
掛載的檔案 (前為server,後為client)
-
測試
課本
wc
指令出來的結果分別為
- 行數 (6)
- 詞數 (9)
- 字數 (45)
Image Not Showing
Possible Reasons
- The image was uploaded to a note which you don't have access to
- The note which the image was originally uploaded to has been deleted
Learn More →
其他參數
-l :只顯示行數
-c :只顯示字元數
-w :只顯示英文字節
Image Not Showing
Possible Reasons
- The image was uploaded to a note which you don't have access to
- The note which the image was originally uploaded to has been deleted
Learn More →
上周的df範例
tr 共定義了很多集合,常用的有:
[:alnum:] 代表所有大小寫字母與數字的集合
[:alpha:] 代表所有大小寫字母的集合
[:blank:] 代表空白
[:digit:] 代表所有數字的集合
[:lower:] 代表所有小寫字母的集合
[:upper:] 代表所有大寫字母的集合
Image Not Showing
Possible Reasons
- The image was uploaded to a note which you don't have access to
- The note which the image was originally uploaded to has been deleted
Learn More →
大小寫轉換
tr "a-z" "A-Z"
Image Not Showing
Possible Reasons
- The image was uploaded to a note which you don't have access to
- The note which the image was originally uploaded to has been deleted
Learn More →
參數 -d (刪除字母)tr -d "a-zA-Z"
Image Not Showing
Possible Reasons
- The image was uploaded to a note which you don't have access to
- The note which the image was originally uploaded to has been deleted
Learn More →
(刪除數字&空白)
Image Not Showing
Possible Reasons
- The image was uploaded to a note which you don't have access to
- The note which the image was originally uploaded to has been deleted
Learn More →
cat
的參數:
-T 抓出tab
-E 顯示結尾
Image Not Showing
Possible Reasons
- The image was uploaded to a note which you don't have access to
- The note which the image was originally uploaded to has been deleted
Learn More →
替換tab tr "\t" " "
Image Not Showing
Possible Reasons
- The image was uploaded to a note which you don't have access to
- The note which the image was originally uploaded to has been deleted
Learn More →
刪除與指定內容相反 tr -d -c "0-9 \n"
(-c : 除了後方選定內容)
Image Not Showing
Possible Reasons
- The image was uploaded to a note which you don't have access to
- The note which the image was originally uploaded to has been deleted
Learn More →
重複的字符以單一一個呈現 tr -s "s"
Image Not Showing
Possible Reasons
- The image was uploaded to a note which you don't have access to
- The note which the image was originally uploaded to has been deleted
Learn More →
(重複的 s n 空格縮成1個而已)
Image Not Showing
Possible Reasons
- The image was uploaded to a note which you don't have access to
- The note which the image was originally uploaded to has been deleted
Learn More →
利用 tr 做一個簡易的加解密(字符替代)
Image Not Showing
Possible Reasons
- The image was uploaded to a note which you don't have access to
- The note which the image was originally uploaded to has been deleted
Learn More →
多個換行轉換
Image Not Showing
Possible Reasons
- The image was uploaded to a note which you don't have access to
- The note which the image was originally uploaded to has been deleted
Learn More →
tr 簡易加解密
tr 命令,Linux tr 命令详解:将字符进行替换压缩和删除 - Linux 命令搜索引擎
產生文字的序列:
文字計算機(bc):
自動對齊: