常用linux指令

Posted 菜鸟决心努力A-A

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了常用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 便可以。

以上是关于常用linux指令的主要内容,如果未能解决你的问题,请参考以下文章

Linux常用指令

Linux常用指令

Linux常用指令

Linux常用指令大全详解

Linux常用指令

Linux常用网路指令