shell基础--cat命令的使用
一.cat的常用用法
1.总结

2.实验
(1).非交互式编辑
[root@~_~ day5]# cat > cattest.sh <<STOP
> hello
> STOP
[root@~_~ day5]# cat cattest.sh
hello
[root@~_~ day5]# cat > cattest.sh << EOF
hello cat with EOF
EOF
[root@~_~ day5]# cat cattest.sh
hello cat with EOF
[root@~_~ day5]# cat > cattest.sh <<~_~
> hdhhdhdhhdhd
> ~_~
[root@~_~ day5]# cat cattest.sh
Hdhhdhdhhdhd
(2).清空文件内容
[root@~_~ day5]# cat cattest.sh
Hdhhdhdhhdhd
[root@~_~ day5]# cat /dev/null > cattest.sh
[root@~_~ day5]# cat cattest.sh
(3).合并
[root@~_~ day5]# cat > cattest.sh <<EOF
> hello
> EOF
[root@~_~ day5]# cat > cattest2.sh <<EOF
> world
> EOF
[root@~_~ day5]# cat cattest.sh cattest2.sh >newfile.sh
[root@~_~ day5]# cat newfile.sh
hello
world
[root@~_~ day5]# cat newfile.sh
hello
world
二.cat命令常用选项
1.总结

shell基础--cat命令的使用的更多相关文章
- shell基础--test命令的使用
test :用于文件类型检查和变量比较 一.用途: 1.判断表达式 2.判断字符串 3.判断整数 4.判断文件 测试例子: (1).test [root@~_~ day5]# cat test.sh ...
- [shell基础]——sed命令
关于sed sed 是一种在线编辑器,它一次处理一行内容.处理时,把当前处理的行存储在临时缓冲区中,称为“模式空间”(pattern space),接着用sed命令处理缓冲区中的内容,处理完成后,把缓 ...
- [shell基础]——read命令
read命令:在shell中主要用于读取输入.变量.文本 1. 接受标准输入(键盘)的输入,并将输入的数据赋值给设置的变量 [按回车键——表示输入完毕] [若输入的数据多于设置的变 ...
- [shell基础]——sort命令
sort命令 sort是按照ASCII码升序输出,且是从首字符依次向后比较的 常见选项 -c 测试文件是否已经被排序 -r 逆向排序 -n 按照数字数值大小排序 -t 指定分割 ...
- [shell基础]——uniq命令
uniq命令常见选项 去除重复行 -u 显示不重复的行 -d 显示有重复的行 -c 打印每一行重复的次数 测试文本内容如下: # cat 4.txt 11 ...
- [shell基础]——cut命令
cut命令常见选项
- [shell基础]——find命令
find命令选项 -name 按照文件名查找 -type 查找某一类型的文件(b 代表设备块:d 目录:c 字符设备文件:l 符号(软)链接文件:f 普通文件) -size 查找文件长度或者大小 -p ...
- [shell基础]——echo命令
echo命令:在shell中主要用于输出 1. -n 不换行的显示结果(默认是换行的) 2. -e " " 支持双引号中使用一些特殊字符 常用的特殊字符有 \a 发出警告 ...
- [shell基础]——tr命令
(1) tr 字符替换 测试文本内容 # cat /etc/hosts 127.0.0.1 localhost localhost.localdomain localhost4 localhost4. ...
随机推荐
- 郭霖 - MVVM开源项目学习
https://blog.csdn.net/guolin_blog/article/details/87900605 https://medium.com/androiddevelopers/view ...
- 针对多类型数据库,集群数据库的有序GUID
一.背景 常见的一种数据库设计是使用连续的整数为做主键,当新的数据插入到数据库时,由数据库自动生成.但这种设计不一定适合所有场景. 随着越来越多的使用Nhibernate.EntityFramewor ...
- Linux学习6-Linux常用命令(2)
目录处理命令 命令名称:mkdir 命令英文原意:make directories 命令所在路径:/bin/mkdir 执行权限:所有用户 功能描述:创建新目录 语法:mkdir -p[目录名 ...
- 一步一步pwn路由器之radare2使用全解
前言 本文由 本人 首发于 先知安全技术社区: https://xianzhi.aliyun.com/forum/user/5274 radare2 最近越来越流行,已经进入 github 前 25了 ...
- 构建微服务:快速搭建Spring Boot项目
Spring Boot简介: Spring Boot是由Pivotal团队提供的全新框架,其设计目的是用来简化新Spring应用的初始搭建以及开发过程.该框架使用了特定的方式来进行配置,从而使开发人员 ...
- redis HyperLogLog 基数估算
HyperLogLog 可以接受多个元素的输入,返回输入元素的基数估算值基数,集合中不同元素的数量.如集合{1,2,3,1,2,3,4}的基数是4.估算,HyperLogLog算法返回的基数不是完全精 ...
- redis介绍(2)简单安装
我分两种方式讲解 window 下载地址:https://github.com/MSOpenTech/redis/releases. Redis 支持 32 位和 64 位.这个需要根据你系统平台的实 ...
- 使用DataTables插件与后台对接表格
function getResults(){ var callResults = $.ajax({ url: "....", //接口url type: "GET&quo ...
- CentOS 中 配置 Nginx 支持 https
一.基础设置: .yum -y update .yum -y install openssl* .cd /usr/local/nginx/conf .mkdir ./ssl .cd ./ssl # 在 ...
- Ubuntu 16.04 c++ Google框架单元测试
环境:Ubuntu 16.04 在github网站上下载gtest框架:终端输入git clone https://github.com/google/googletest.git 然后找到 gool ...