乖乖服輸找地方寫起來....最好還是可以search的地方
跟帳號有關 改/etc/passwd , /etc/shadow
sudo懶得打密碼 改/etc/sudoers %sudo ALL=NOPASSWD: ALL
沒DNS server 改 /etc/hosts
ssh 設定 找 .ssh/id_rsa ; run ssh-keygen ; view .ssh/id_rsa.pub
--- scp [-r: 遞迴抓] -P [PORT] [user]@[server_ip]:/home/XXX/OOO [本地要放的地方]
#建立ssh, 跟remote說我要把[我自己的port:]2323串到bbs.gamer.com.tw的port:23
ssh -NfL 2323:bbs.gamer.com.tw:23 remote_ip
#連自己的2323; 也就連到巴哈了
telnet localhost 2323
#建立ssh, 跟remote說我要把[你remote的port:]2222串到localhost的port:22
ssh -NfR 2222:localhost:22 remote_ip
#然後你跑到remote_ip的地方, 登入進去, 用ssh連到remote_ip的localhost:2222; 就連回剛剛的電腦
ssh localhost -p 2222
~~~~這裡的localhost:22, 是remote_ip的localhost:22? 還是剛剛電腦的localhost:22? 找時間搞清楚
4. Configure sshd for chroot jail
http://forum.ubuntu.org.cn/viewtopic.php?f=171&t=376479
http://how-to.linuxcareer.com/how-to-automatically-chroot-jail-selected-ssh-user-logins
All what remains is to configure sshd to automaticaly redirect all users from the chrootjail usergroup to the chroot jail at /var/chroot. This can be easily done be editing the sshd configuration file /etc/ssh/sshd_config. Add the following to /etc/ssh/sshd_config:
Match group chrootjail ChrootDirectory /var/chroot/
tftpd : -s: 用chroot去執行
The -s option provides additional security by changing tftpd's root directory, thereby prohibiting accesses outside of the specified directory. Because chroot(2) requires super-user privileges, tftpd must be run as root. However, after performing the chroot(), tftpd will set its user id to that of the specified user, or ``nobody'' if no -u option is specified.
sudo /etc/init.d/xinetd reload
git reset HEAD^ 取消HEAD的紀錄, 檔案改動仍然還在
git reset --soft HEAD^ 取消HEAD的紀錄, 檔案改動仍然還在, 但放進staging zone
git reset --soft HEAD^ 取消HEAD的紀錄, 檔案改動被還原
git commit --amend 對HEAD的紀錄繼續修改
git rev-list --all 顯示commit的md5碼
repo init -u [http][https][ssh][git]://XXXX
repo start [隨便取名字] [資料夾位置]
VI 基本設定檔 在自己家放個 .vimrc
基本設定 寫個兩行
set nocompatible
set backspace=2
" 檔案編碼
set encoding=utf-8
set fileencodings=utf-8,cp950
" 編輯喜好設定
syntax on " 語法上色顯示
set nocompatible " VIM 不使用和 VI 相容的模式
" set ai " 自動縮排
set shiftwidth=4 " 設定縮排寬度 = 4
set tabstop=4 " tab 的字元數
set softtabstop=4
set expandtab " 用 space 代替 tab
set ruler " 顯示右下角設定值
set backspace=2 " 在 insert 也可用 backspace
set ic " 設定搜尋忽略大小寫
set ru " 第幾行第幾個字
set hlsearch " 設定高亮度顯示搜尋結果
set incsearch " 在關鍵字還沒完全輸入完畢前就顯示結果
set smartindent " 設定 smartindent
set confirm " 操作過程有衝突時,以明確的文字來詢問
set history=100 " 保留 100 個使用過的指令
set cursorline " 顯示目前的游標位置
set laststatus=2
set statusline=%4*%<\%m%<[%f\%r%h%w]\ [%{&ff},%{&fileencoding},%Y]%=\[Position=%l,%v,%p%%]
colorscheme torte
VI 想看行數 :set number ; 不想看 :set nonumber
:s/AAA/BBB
更换当前所在行的第一个AAA为BBB
:s/AAA/BBB/g
更换当前行的所有AAA为BBB
:50,100s/AAA/BBB/g
更换50~100行里所有的AAA为BBB
:%s/AAA/BBB/g
修改当前行及之后全部的AAA为BBB
VI裡面特殊符號^M 1. Ctrl按住, 2.按V, 3.按M 可以把該死的^M砍光
安裝JDK? 善用update-alternatives 去對付這個渾蛋....
sudo update-alternatives --config java 檢查一下你裝成甚麼樣子了
改環境變數
export XXX=OOO
改個人環境變數設定:(開放使用者可自行修改)
/home/[username]/.bashrc
改全域使用者環境變數設定:(只有 root 可以修改)
/etc/profile
環境變數建立順序
/etc/profile
/etc/environment <-- PATH被定義在這裡, 改這邊很危險
~/.profile
/etc/bashrc
~/.bashrc
shell script開頭加
#!/bin/bash or sh
Awk
Awk 是一種字串處理工具,不論在指令模式或者撰寫 Shell Script 時也十分有用,以下是 Awk 的使用例子:
# awk '{ print }' /etc/passwd
以上指令將 /etc/passwd 作為 awk 的輸入檔案,並會將 /etc/passwd 檔案的內容逐行輸出。但這樣使用 awk 看不出它的作用,以下是另一個例子:
# awk -F":" '{ print $1 }' /etc/passwd
$ awk '{ print $0 }' /etc/passwd
在 awk 中,$0 變量表示整個當前行,所以 print 和 print $0 的作用完全一樣。
刷白SDcard
Under Windows:
> diskpart
> list disk
> select disk [n]
> list partition
> select partition [n]
> delete partition
執行以上指令直到SDcard裡面分割區都砍光
使用dd Under Windows:
> dd if=~ od=G: bs=~ seek=~
增加ppa 支援apt-get 參考點
sudo apt-add-repository XXXX
TAR 打包解包壓縮解壓縮
//打包
tar cvf [包.tar] [內容物]
//解包
tar xvf [包.tar]
//壓縮
gzip [檔案]
//解壓縮
gunzip [檔案.gz]
//壓縮打包
tar zcvf [包.tar.gz] [內容物](...)
tar jcvf [包.tar.bz2] [內容物](...)
//解包解壓縮
tar zxvf [包.tar.gz]
tar jxvf [包.tar.bz/包.tar.bz2]
schroot 拿來開 ubuntu 10.04 省的為了一些龜毛tool去裝OS 感謝neo叔引我進入schroot世界
schroot -c [name] #跳進去箱子
schroot -l #列出目前已經設定好的箱子
別裝到舊版schroot ; conf格式有差
schroot.conf 範例 :
[lucid]
description=Ubuntu 10.04
directory=/home/rob/u1004
users=rob
root-users=rob
type=directory
在/etc/schroot/default/ 下面 這些檔案
fstab
指定原系統當中會被掛載進子系統的目錄
注意!schroot預設把/home掛進去了,這點與dchroot, chroot不同
copyfiles
指定每次進入子系統時,原系統中會被拷貝進去子系統的檔案
nssdatabases
指定每次進入子系統時,原系統中會被拷貝進去子系統的資料庫,如passwd, shadow, group
檢查OS版本有很多方法
cat /etc/*-release
cat /proc/version
uname -a
if apt-get failed:
First things first, try the command it's telling you to try:
apt-get -f install
To fix any broken packages. If your disk is full, this may or may not work depending on whether the broken package has been completely downloaded.
If the above doesn't work for lack of space, try
aptitude clean
to free up some space. Note, however, that this will clean your
apt
package cache (these are .deb
files for the packages you installed; stored in /var/cache/apt/archives
); the actual packages will remain installed, but you will no longer have the .deb
files on disk and would need to re-download them if you purge/re-install an existing package.
Update
In response to your edited question, I think you need:
apt-get purge vim vim-runtime
apt-get install vim vim-runtime
沒有留言:
張貼留言