美文网首页
echo、tail和重定向符

echo、tail和重定向符

作者: 超级无敌大蜗牛 | 来源:发表于2023-04-05 10:24 被阅读0次

1.echo命令

在命令行内输出指定内容,输出内容比较复杂的时候,用双引号包括

echo "helo linux"

反引号

反引号包围的是命令,而不是简单输出echo后面的内容

echo `pwd`
/home/itheima

echo pwd
pwd

echo "我的工作路径是:`pwd`"

重定向符

重定向符:>和>>
(1)>,将左侧命令的结果,覆盖写入到符号右侧指定的文件中
(2)>>,将左侧命令的结果,追加写入到符号右侧指定的文件中

echo "hello linux" > test.txt
cat test.txt
hello linux

echo "im linux" >> test.txt
cat test.txt
hello linux 
im linux

2.tail命令

使用tail命令,可以查看文件尾部的内容。
tail [-f -n] 路径

  • -f,表示持续追踪
  • -n,表示行数

相关文章

网友评论

      本文标题:echo、tail和重定向符

      本文链接:https://www.haomeiwen.com/subject/codsddtx.html