個人備忘用
正常情況下,要把應用程式的輸出重新導向到檔案可以輸入
target.exe -some_args > output.txt
但如果發現導向後的文字檔沒東西,則可能該程式是將文字輸出到stderr,那就把指令改成
target.exe -some_args 2> output.txt
/* stdin = 0, stdout = 1, stderr = 2 */
又,如果要對程式輸出的文字做處理
例如過濾某些文字所在的行,可以把輸出再pipe( | )到find指令,然後用參數/v來過濾掉不想要的輸出
target.exe -some_args | find /v "what we don't want"
但因為pipe只接受stdout的輸出,如果應用程式是將文字輸出到stderr,那就把指令改成
target.exe -some_args 2>&1 | find /v "what we don't want"
/* 把stderr重新導向到stdout,就可以pipe到find了 */
其它參考
http://forum.twbts.com/viewthread.php?tid=10215
2018年11月22日 星期四
2018年8月15日 星期三
【記錄】VirtualBox 虛擬機與主機檔案共享,以FTP實現,Maybe easier?
基本概念是透過VirtualBox的Host-only Network Adapter來讓主機跟虛擬機互通
如果主機是Windows,下載任意一款FTP Server軟體,設定好要分享的資料夾跟帳號密碼之類的之後開啟,防火牆要允許該軟體在公用網域下通過,因為Host-only Network Adapter會被Windows視為無法辨識的網路,會被強制設定在公用網域
Linux Host的話...我會乾脆直接走sftp,Windows Guest去下載FileZilla就好了,輕鬆愉快
Linux Host的話...我會乾脆直接走sftp,Windows Guest去下載FileZilla就好了,輕鬆愉快
2. VirtualBox:
a. 增加一張僅限主機介面卡,開啟DHCP伺服器,並記下這張網卡的IP
b. 對虛擬機增加一張介面卡,附加到僅限主機介面卡
3. 虛擬機端
用任何可以連FTP的軟體連上主機的IP就可以了,以下成果圖
隨手寫寫,哪天想到再寫完整一點
2018年7月18日 星期三
【Record】Fix r8168 NIC driver on Linux kernel >= 4.15
r8168/r8169 driver on Linux kernel >= 4.15 have some annoying issue.
In my case, if I reboot my laptop, I couldn't connect via wired network.
I need shutdown then boot again to solve it.
Tested on Ubuntu Mate 18.04 with kernel 4.15.0.24.
1. Download original driver from Realtek and extract it.
$ tar jxvf 0010-r8168-8.045.08.tar.bz2
$ cd r8168-8.045.08
2. Download patch from archlinux's official git repository [Link] and put it to the directory we just extracted.
3. Patch it.
$ patch -p1 < linux-4.15.patch
4. Then just run the script, it will compile and install automatically.
$ sudo ./autorun.sh
5. Done.
Oh, maybe need disable r8169.
In my case, if I reboot my laptop, I couldn't connect via wired network.
I need shutdown then boot again to solve it.
Tested on Ubuntu Mate 18.04 with kernel 4.15.0.24.
1. Download original driver from Realtek and extract it.
$ tar jxvf 0010-r8168-8.045.08.tar.bz2
$ cd r8168-8.045.08
2. Download patch from archlinux's official git repository [Link] and put it to the directory we just extracted.
3. Patch it.
$ patch -p1 < linux-4.15.patch
4. Then just run the script, it will compile and install automatically.
$ sudo ./autorun.sh
5. Done.
Oh, maybe need disable r8169.
訂閱:
文章 (Atom)