常用linux指令

對目錄下(以及子目錄下)所有文件進行操作

  1. 顯示目錄下所有文件,包括子目錄下的文件
    ls -R
  2. 將文件夾下所有字符進行替換:
    http://www.cnblogs.com/Ryan-Lee/p/5855899.html
sed -i 's/arm-none-linux-gnueabi/arm-linux/g' `grep arm-none-linux-gnueabi . -rl`

這個命令是將當前目錄下代碼中所有的”arm-none-Linux-gnueabi” 替換成 “arm-linux”

  1. ctags使用
    ctags -R 建立
    ctrl ]
    ctrl [

  2. scp報錯

scp 1.txt root@192.168.1.25:/tmp
The authenticity of host '192.168.1.25 (192.168.1.25)' can't be established.
RSA key fingerprint is 6c:28:23:df:45:d5:c8:79:4d:9e:ed:f6:f2:73:22:4c.
Are you sure you want to continue connecting (yes/no)?
提示輸入yes後,屏幕不斷出現y,只有按ctrl + c結束
錯誤是:The authenticity of host 192.168.1.xxx can't be established.

然後執行
ssh -o StrictHostKeyChecking=no 192.168.1.xxx
就OK
然後
在一,在linux100主機裏的用戶
運行
ssh-keygen -t rsa
結果如下

QUOTE: 
Generating public/private rsa key pair. 
Enter file in which to save the key (/home/.username/ssh/id_rsa):#回車 
Enter passphrase (empty for no passphrase):#回車 
Enter same passphrase again:#回車 
Your identification has been saved in /home/.username /.ssh/id_rsa. 
Your public key has been saved in /home/.username /.ssh/id_rsa.pub. 
The key fingerprint is: 
38:25:c1:4d:5d:d3:89:bb:46:67:bf:52:af:c3:17:0c username@localhost 
Generating RSA keys: 
Key generation complete.

會在用戶目錄~/.ssh/產生兩個文件,id_rsa,id_rsa.pub
二,把linux100主機上的id_rsa.pub文件拷貝到linux200主機的root用戶主目錄下的.ssh目錄下,並且改名爲authorized_keys
即:
/root/.ssh/authorized_keys
如果已經有authorized_keys這個文件,將id_rsa.pub的內容拷貝到 authorized_keys文件中。cat id_rsa.pub >> authorized_keys 便可以。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章