2021年10月20日 星期三

Linux find使用

 


find "{$PATH}" -name "file name" -exec grep -H "{$CONTENT}" {} \;

例如:

find / -name abc.xml
搜尋整個系統中, 是否有檔名為abc.xml的檔案.


find ./kernel -name "*.txt" -exec grep -H "test" {} \;  
要搜尋./kernel底下所有的.txt檔, 內容含有"test"的地方.

參考:https://dotblogs.com.tw/grayyin/2016/09/12/134821

2021年10月19日 星期二

Putty 白底黑字設定

 用了幾天的Putty,黑底白字還不錯,不過綠字、藍字就真的是給他很不清楚,


Putty--> Window-->Colours-->General options for colour usage
勾選 Use system colours
存檔後,再用Putty登入,就成了我要的白底彩字畫面了

參考:http://blog.3cnet.tw/2013/08/putty.html

2021年9月2日 星期四

2021年8月27日 星期五

建立一個都為0的檔案容量,並設定其大小

 Linux

dd if=/dev/zero of=test bs=1M count=100000  --製作test檔案為100000M


Windows

fsutil file createnew <file_name> <file_size_in_kBs>

fsutil file createnew test  1073741824  --製作test檔案為1G(要*1024)



2021年8月26日 星期四

Linux 下SSH限制IP和使用者登入

centos 安裝 ssh

yum install openssh openssh-server 

修改遠端ssh登入

vi /etc/ssh/sshd_config

將#PermitRootLogin yes 的#拿掉

請參閱

https://www.itread01.com/content/1548655050.html

https://www.itread01.com/p/1373923.html

https://codertw.com/%E4%BC%BA%E6%9C%8D%E5%99%A8/382291/

主要修正

允許單一IP

# vim /etc/hosts.allow最後一行加入:

sshd:IP:allow //多個IP可以按照此格式寫多行

# vim /etc/hosts.deny最後一行加入:

sshd:ALL //除了上面允許登入的IP,其它IP都拒絕登入

# service sshd restart


允許網段

# vim /etc/hosts.allow最後一行加入

sshd:x.x.x.*:allow

# vim /etc/hosts.deny最後一行加入:

sshd:ALL

# service sshd restart


只允許192.168.0.222以sct使用者身份、192.168.1.135以root使用者身份登入192.168.1.81

# vim /etc/ssh/sshd_config最後一行加入

AllowUsers sct@192.168.0.222 root@192.168.1.135 //多個使用者名稱@IP之間使用空格分隔

# service sshd restart

192.168.0.222以預設的root使用者身份不能正常登


2021年8月20日 星期五

Ndc Odf 執行後,無動作

 建議可以嚐試 刪除 C:\Users\使用者名稱\AppData\Roaming\NDCODFApplicationTools 目錄,並重新啟動 ODF 文件應用工具來重設軟體預設值。

Windows中使用 attrib 指令徹底隱藏指定文件/資料夾

 進入dos視窗,輸入 attrib +s +a +h (+h 後需要輸入一個空格!)並再將你想隱藏的文件/資料夾拖入命令行中,如果已經無需隱藏的話,可以重新打開「cmd」,然後輸入 attrib -s -a -h 並將你想隱藏的文件/資料夾拖入命令行中