2011年6月24日 星期五

[轉貼]grep 包含子目錄檔案的方法

http://blog.xuite.net/jyoutw/xtech/46682931

在所有的網頁中,找出含有某特定字串的檔案。
例如說要找出含有 localhost 字串的檔案,記得 grep 沒有 recursive 的參數,可以搜尋包含子目錄
所以就要利用 find 的功能來協助

# find ./ -type f -name \*.php |xargs grep 'localhost'


用上面的方式連是哪個檔案都會列出來,若用下列的寫法,速度既慢而且也無法得知是哪個檔案有含該字串:
# find ./ -type f -name \*.php -exec grep 'localhost' {} \;
 

2011年6月12日 星期日

[轉貼]解析度過大導致螢幕黑畫面

http://www.ubuntu-tw.com/modules/newbb/viewtopic.php?topic_id=20514&viewmode=flat&order=ASC&type=&mode=0&start=0&menumode=2

(要改的東東在 wubi 的 img檔裡,還要做掛 img檔的步驟…)


按ctrl+alt+F1進入文字介面
sudo nano /etc/X11/xorg.conf
看看有沒有內容,沒有的話Ctrl+X跳出
照順序執行:
sudo /etc/init.d/gdm stop
sudo X -configure
sudo mv /root/xorg.conf.new /etc/X11/xorg.conf
sudo nano /etc/X11/xorg.conf
到此xorg.conf已有內容,
找出"Monitor"這一個區塊
加入HorizSync和VertRefresh兩項,
數值請參照螢幕說明書找 水平同步 跟 垂直更新
然後Ctrl+X按y存檔,
最後sudo /etc/X11/gdm start

改完類似這樣:
Section "Monitor"
Identifier "Monitor0"
HorizSync 30.0 - 80.0
VertRefresh 60.0 - 75.0
EndSection

mount wubi disk

http://ubuntuforums.org/showthread.php?t=1564156

Code:
sudo mount -o loop //root.disk /mnt
nautilus /mnt   # to browse
If you have problems mounting it, you can fsck it (don't do it if you mounted it already):

Code:
sudo fsck //root.disk


http://ubuntuforums.org/showthread.php?t=1037874
Make a new text file:

Code:
#!/bin/sh
sudo mkdir -p /media/WindowsXP
echo "Mounting NTFS Partition"
sudo mount -t ntfs /dev/sda1 /media/WindowsXP
sleep 1
sudo mkdir -p /media/root.disk
echo "Mounting Wubi Disk"
sudo mount -o loop /media/WindowsXP/ubuntu/disks/root.disk /media/root.disk
sleep 1
echo "Done :)"
gksu nautilus /media/root.disk
exit 0 &
Save this as mountwubi.sh. Right click this new file, select Permissions tab and put a tick in the Execute box.

Create another text file:

Code:
#!/bin/sh
echo "Unmounting Wubi Disk"
sudo umount /media/root.disk
sleep 1
echo "Unmounting NTFS Partition"
sudo umount /media/WindowsXP
sleep 1
echo "Done :)"
exit 0 &
Save this as umountwubi.sh. Right click this new file, select Permissions tab and put a tick in the Execute box.


Double clicking mountwubi.sh and selecting Run in Terminal will mount your old wubi install and open a root nautilus for full access to the files.
The function of umountwubi.sh is pretty obvious

BloggerAds