每天学一点儿shell:linux常用指令

文章目录

  • cat结合grep搜索关键字
  • find搜索文件内容
  • scp上传下载
  • curl发送POST请求
  • 常用快捷键和命令
  • xshell的rz和sz

cat结合grep搜索关键字

[root@hadoop-master test]# cat -n file1.txt |grep "1"
     1	第1行
    10	第10行

find搜索文件内容

下面是搜索当前文件夹下以.txt结尾,并且内容包含“5”的内容

[root@hadoop-master test]# find ./*.txt  -type f | xargs grep "5"
./file1.txt:第5行
./file2.txt:第5行

scp上传下载

上传
上传单个文件到服务器

[root@hadoop-master test]# scp ./uploadScpTest.txt root@hadoop-slave1:/usr/local/test
uploadScpTest.txt  

上传目录到服务器

[root@hadoop-master test]# scp -r ./ root@hadoop-slave1:/usr/local/test
uploadScpTest.txt  

下载
从服务器把文件下载到本地目录

[root@hadoop-master test]# scp root@hadoop-slave1:/usr/local/test/scptest.txt ./
scptest.txt    

把整个目录下载到本地

[root@hadoop-master test]# scp -r root@hadoop-slave1:/usr/local/test ./
file1.txt   

curl发送POST请求

curl -H "Content-Type: application/json" -X POST -d '{"user_id": "123", "coin":100, "success":1, "msg":"OK!" }' "http://192.168.0.1:8001/test"

CURL 发送POST请求

常用快捷键和命令

每天学一点儿shell:linux常用指令_第1张图片

xshell的rz和sz

rz上传文件
rz:received(接收),服务器接收文件,也就是本地上传到服务器。
每天学一点儿shell:linux常用指令_第2张图片
sz下载文件
sz:send(发送),服务器发送文件,也就是本地从服务器下载文件。
每天学一点儿shell:linux常用指令_第3张图片

你可能感兴趣的:(每天一点儿Shell)