常用linux指令

来源:互联网 发布:樱井知香步兵番号 编辑:程序博客网 时间:2024/06/05 11:10

对目录下(以及子目录下)所有文件进行操作

  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:/tmpThe 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 便可以。

0 0
原创粉丝点击