開機時只出現了
error: file not found.如果你確定沒有把開機的 partition 弄壞,可以用以下指令試試看:
grub rescue> _
- ls
- 會列出所有可用的 partition
- 例如 (hd0) (hd0,gpt1) ....
- 找到可以開機的那個磁區
- set prefix=(hd0,gpt2)/boot/grub
- insmod normal
- normal
開機完要記得重新裝一次 GRUB
- $ grub-install /dev/sda
- $ update-grub
error: file not found.如果你確定沒有把開機的 partition 弄壞,可以用以下指令試試看:
grub rescue> _
auto eth0
iface eth0 inet dhcp
auto eth0$ sudo apt-get purge network-manager
iface eth0 inet static
address 192.168.0.7
netmask 255.255.255.0
gateway 192.168.0.254
pre-up /sbin/ethtool -s eth0 speed 1000 duplex full
dns-nameservers 192.168.0.45 192.168.8.10 8.8.8.8
dns-search foo.org bar.com
$ lsblk -t /dev/sdc
NAME ALIGNMENT MIN-IO OPT-IO PHY-SEC LOG-SEC ROTA SCHED RQ-SIZE
sdc 0 4096 0 4096 512 1 cfq 128
|--sdc1 0 4096 0 4096 512 1 cfq 128
|--sdc2 0 4096 0 4096 512 1 cfq 128
|--sdc3 0 4096 0 4096 512 1 cfq 128
$ compgen -W "list arg1 arg2 ls" -- arg
arg1
arg2
$
$ compgen -d -- di
dir2
dir1
$
讓我們看一下最簡單的範例。補完指令 --help --verbose --version。
(範例來自 www.debian-administration.org)
_foo() { local cur prev opts COMPREPLY=() cur="${COMP_WORDS[COMP_CWORD]}" prev="${COMP_WORDS[COMP_CWORD-1]}" opts="--help --verbose --version" if [[ ${cur} == -* ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) return 0 fi } complete -F _foo foo
add foo 0 0 11
hello world
STORED
get foo
VALUE foo 0 11
hello world
END
delete foo
DELETED
$m = new Memcached();
$m->addServer('localhost', 11211);
$m->set('int', 99);
$m->set('string', 'a simple string');
$m->set('array', array(11, 12));
/* expire 'object' key in 5 minutes */
$m->set('object', new stdclass, time() + 300);
var_dump($m->get('int'));
var_dump($m->get('string'));
var_dump($m->get('array'));
var_dump($m->get('object'));
?>
$source = filter_input(INPUT_GET, 'source', FILTER_SANITIZE_STRING);
$config = array(
'indent' => true,
);
$tidy = new tidy();
$tidy->parseString($html, $config, 'utf8');
$tidy->cleanRepair();
$output = (string) $tidy;
sudo apt-get install transmission-daemon設定 /etc/transmission-daemon/settings.json
cd /home
sudo mkdir -p ./torrents/download
sudo mkdir ./torrents/upload
sudo mkdir ./torrents/incomplete
sudo chown -R debian-transmission:debian-transmission ./torrents
sudo chmod g+w -R ./torrents/
sudo ufw allow 9091
sudo ufw allow proto tcp to any port 49152:65535
sudo /etc/init.d/transmission-daemon stop
sudo vim /etc/transmission-daemon/settings.json
"download-dir": "/home/torrents/download",把你的帳戶加入 transmission 所屬 group
"incomplete-dir": "/home/torrents/incomplete",
"incomplete-dir-enabled": true,
"rpc-authentication-required": true, // 需要驗證
"rpc-whitelist": "127.0.0.1,192.168.*.*", // 可以連線的 ip
"rpc-username": "你的帳戶",
"rpc-password": "你的密碼",
"umask": 2, // 讓下載的檔案 user & group 擁有相同權限
"port-forwarding-enabled": false,
"peer-port-random-on-start": true,
"upload-limit": 100, // 上傳限制 100 K
"upload-limit-enabled": 1, // 啟用上傳限制
sudo usermod -a -G debian-transmission讓 transmission-daemon 重新讀取設定 (當他關閉時會自動複寫 settings.json)
invoke-rc.d transmission-daemon reload啟動 transmission-daemon
sudo service transmission-daemon start打開瀏覽器, 輸入網址
http://就可以開始用網頁操作了。:9091/transmission/web/
sudo apt-get install minidlna建立 DLNA server 檔案目錄
sudo mkdir -p /d/music設定防火牆 ufw (我的區網是 192.168.1.*)
sudo mkdir -p /d/photo
sudo mkdir -p /d/video
sudo chown -R minidlna:minidlna /d/
sudo mkdir -p /var/{cache,log}/minidlna
sudo chown -R minidlna:minidlna /var/{cache,log}/
sudo ufw allow from 192.168.1.0/24 to any port 1900 proto udp設定 /etc/minidlna.conf
sudo ufw allow from 192.168.1.0/24 to any port 8200 proto tcp
friendly_name=Ubuntu DLNA Server # 要顯示的名稱重建 media db & restart
network_interface=eth1 # 如果不是 eth0, 請指定
media_dir=A,/d/music
media_dir=P,/d/photo
media_dir=V,/d/video
db_dir=/var/cache/minidlna
log_dir=/var/log
inotify=yes # (default)
enable_tivo=no # (default)
strict_dlna=no # (default)
notify_interval=900 # (default)
serial=12345678 # (default)
model_number=1 # (default)
sudo service minidlna stop
sudo service minidlna force-reload
sudo service minidlna start