导读 命令不全:在命令没有输入完 (引号或括号没有配对),就不小心按下了Enter键,终端会提示出一个>代表命令不完整,这是可以继续输入,也可以ctrl+c终止输入,重新再来。(下面sed命令使用时,还有另外一种命令不全的问题)
Linux下命令的一些异常情况

命令不全:在命令没有输入完 (引号或括号没有配对),就不小心按下了Enter键,终端会提示出一个>代表命令不完整,这是可以继续输入,也可以ctrl+c终止输入,重新再来。

下面sed命令使用时,还有另外一种命令不全的问题
ct@ehbio:~/ehbio_project$ rename 'ehbio2
>'
ct@ehbio:~/ehbio_project$ rename 'ehbio2
> ^C
ct@ehbio:~/ehbio_project$

文件名输入错误: 多一个字母、少一个字母、大小写问题
ct@ehbio:~/ehbio_project$ls
ehbio2.fa  ehbio3.fa  ehbio4.fa  ehbio.fa  second.fa

# 重命名没有生效
ct@ehbio:~/ehbio_project$ rename 'ehbio2' 'ehbio5' ebio2.fa
ct@ehbio:~/ehbio_project$ ls
ehbio2.fa  ehbio3.fa  ehbio4.fa  ehbio.fa  second.fa

# 仔细看是ehbio2.fa写成了ebio2.fa,更正后即可。
Z8vb3e9jtel4m99ss6e7eZ:~/ehbio_project$ rename 'ehbio2' 'ehbio5' ehbio2.fa
ct@ehbio:~/ehbio_project$ ls
ehbio3.fa  ehbio4.fa  ehbio5.fa  ehbio.fa  second.fa
所在目录不对: 访问的文件不存在于当前目录,而又没有提供绝对路径, 或软连接失效
ct@ehbio:~/ehbio_project$ ls
ehbio3.fa  ehbio4.fa  ehbio5.fa  ehbio6.fa  ehbio.fa  second.fa
ct@ehbio:~/ehbio_project$ ls ../data
ehbio2.fa  first.fa

# 当前目录没有ehbio2.fa
ct@ehbio:~/ehbio_project$ less ehbio2.fa
ehbio2.fa: 没有那个文件或目录

# ehbio2.fa在上一层目录的data目录下
ct@ehbio:~/ehbio_project$ ls ../data/ehbio2.fa 
../data/ehbio2.fa

# 加上路径依然访问不了 
ct@ehbio:~/ehbio_project$ less ../data/ehbio2.fa 
../data/ehbio2.fa: 没有那个文件或目录

# 上面的问题是软连接失效,在之前的操作中删掉了原始的ehbio2.fa,所以快捷方式失效

# 正确的访问
ct@ehbio:~/ehbio_project$ tail -n 3 ../data/first.fa 
ACGGAGCGAGCTAGTGCAGCGAGGAGCTGAGTCGAGC
CAGGACAGGAGCTA
end

原文来自:https://zhuanlan.zhihu.com/p/32989450

本文地址:https://www.linuxprobe.com/linux-learning-command.html编辑:坑人小妖精,审核员:逄增宝

Linux命令大全:https://www.linuxcool.com/

Linux系统大全:https://www.linuxdown.com/

红帽认证RHCE考试心得:https://www.rhce.net/