1. cat              cat is used to read, display, or concatenate the contents of a file

cat file.txt //show the content of file.txt 显示file.txt中的内容
cat file.txt file1.txt.... //show the content of file.txt file1.txt ..... 显示多个文件file.txt file1.txt...的内容
cat file.txt | tr -s '\n' //show the content of file.txt. It will squeeze adjacent '\n' characters into a single '\n' 显示file.txt的内容,并且将连续的空行换成一个
cat -T file.txt //show the content of file.txt and highlight tab characters as ^I 显示file.txt中的内容,并且将TAB自付显示为^I
cat -n file.txt //show each line with a line number prefixed 显示文件中的内容,每一行带有行号
cat file1.txt file3.txt | xargs //show the content of file1.txt and file3.txt without any enter '\n'
cat file1.txt | xargs -n 3 //Converting single line into multiple line output and every line has 3 words (the default delimiter is space, so we could thinks it as words)

2. find          list all the files and folders from the current directory to the descending child directories

find base_path //list all files and subfiles in base_path
find /root/deploy_ws/ -name "testlist.*" //list all files with filename starting with testlist in /root/deploy_ws
find /root/deploy_ws/ -iname "testlist.*" //list all files with filename starting with testlist in /root/deploy_ws, the more important is to ignore case
find /root/deploy_ws \( -name "testlist.*" -or -name "*.plugin" \) -print //list all files with filename starting with testlist or ending with plugin
find /root/deploy_ws \( -name "testlist.*" -and -name "*.plugin" \) //list all files with filename starting with testlist and ending with plugin
find /root/deploy_ws -path "*BAT*" -print //list all files in /root/deploy_ws and the path for the files should match BAT*
find . -regex ".*\(\.txt\|\.sh\)$" //list all files with filename ending with txt or sh in current dir.
find . ! -name "*.txt" -print    //list files the name does not end with .txtfind . -type d -print  //List only directories including descendantsfind . -type f -print  //List only regular filesfind . -type l -print //List only symbolic linksfind /usr/lib/firefox/plugins -type l -print  //list symbolic links in /usr/lib/firefox/pluginsfind . -type f -name "*.sh" -delete  //delete all files whose type is file and filename end with .sh

3. tr  tr [–c/d/s/t] [SET1] [SET2] 不指定options,默认是-t

  • Replace all uppercase characters to lowercase characters. (-t) 将大写字符替换为小写字符
#echo "HELLO WHO IS THIS" | tr 'A-Z' 'a-z'
hello who is this

  • -d Delete specified characters   删除指定的字符
#cat file1.txt
This is the first line inside file1.txt
# cat file1.txt | tr -d 'first'
Th  he  lne nde le1.x

  • -c Filter characters which isn't included in set1 . The example following is to delete all the characters from the input text except the ones specified in the complement set.  删除除了在列表中的其余所有的字符 -c 相当于补集的功能。
# echo hello 1 char 2 next 4 | tr -d -c '0-9 \n'   1  2  4

  • –s option to squeeze repeating characters from the input
# echo aaacccddd | tr -s [a-z]
acd

4. mkdir

  • -p
#mkdir -p /root/deploy_ws/shellTest/newDir/newDir    //ignores if any level of directory exists and creates the missing directories.

转载于:https://www.cnblogs.com/KarenWang/p/4545633.html

shell command cat/find/tr/mkdir相关推荐

  1. 7.13. parallel - build and execute shell command lines from standard input in parallel

    并行执行shell命令 $ sudo apt-get install parallel 例 7.5. parallel - build and execute shell command lines ...

  2. linux shell tr,shell脚本 之 tee tr

    tee :就是将输出定位到文件中,类似于 > . 主要参数 -a -a:追加的方式 等同于 >> 默认的情况下是覆盖.若是文件已经存在的话! ping www.sina.com.cn ...

  3. linux shell tr命令,shell脚本中的tr用法

    tr 用来从标准输入中通过替换或删除操作进行字符转换. tr 主要用于删除文件中控制字符或进行字符转换. 使用tr时要转换两个字符串:字符串1用于查询,字符串2用于处理各种转换. tr刚执行时,字符串 ...

  4. OS + Linux Shell Command find

    Linux中find常见用法示例 http://www.iteye.com/topic/587714 http://icarusli.iteye.com/blog/646424 http://tayl ...

  5. linux shell之xargs 、tr、sha1sum、head、tail一般使用

    1 xargs命令 有点类似-exec命令 1)删除当前目录下面的c文件 find . -name "*.c" | xargs rm 2)统计当前c文件里面的代码行数 find . ...

  6. 【UEFI/BIOS】UEFI Shell Command (UEFI Shell 命令)篇目一

    Shell 命令: 命令 作用 alias 在UEFI Shell环境中显示.创建.删除别名 attrib 显示或更改文件或目录的属性 bcfg 操作Boot或者驱动程序顺序 cd 显示或更改当前目录 ...

  7. readv、io_uring、liburing and command cat

    使用多种方式实现 cat 命令的等效程序. 文章目录 readv version of cat io_uring version of cat liburing version of cat read ...

  8. shell command 输入时的快捷键

    2019独角兽企业重金招聘Python工程师标准>>> Ctrl+A Move cursor to start of line. Ctrl+E Move cursor to end ...

  9. 神奇的BPF四 用bpftrace 开个后门

    一 前言 前面的文章聊到bpftrace,这是个强大简洁的编写bpf程序的利器,内部的语法看起来比较容易,功能一点也不弱,比如 我们想查看现在系统中谁在执行什么程序: [root@localhost ...

  10. linux脚本控制,linux控制脚本

    1.处理信号 1 SIGUP 挂起进程 2 SIGINT 终止进程 (CTRL + C) 3 SIGQUIT 停止进程 9 SIGKILL 无条件终止进程 15 SIGTERM 可能的话终止进程 17 ...

最新文章

  1. float对div宽度的影响
  2. html的meta总结,html标签中meta属性使用介绍和   动态替换字符串
  3. java maven项目构建ssh工程 父工程与子模块的拆分与聚合
  4. html中两行三列怎样写,html – Flexbox 3 divs,两列,一列有两行
  5. SQL查询效率注意事项
  6. python类的mod_apache+mod_python
  7. Java常用设计模式————抽象工厂模式
  8. multism中ui和uo应该怎么表示_欧阳娜娜上节目痛哭,坦言压力太大睡不着,明星都怎么了?...
  9. 苹果笔记本怎么安装python_MAC中怎么安装python
  10. swing tree 去掉双击默认展开 关闭_如何保护自己的电脑,关闭危险端口(一)
  11. 【LeetCode】【数组】题号:*665,非递减数列
  12. 中兴MF667S WCDMA猫Linux拨号笔记
  13. 华为管理学案例分析_华为管理成功案例分析答案
  14. flutter 文字颜色渐变
  15. 美敦力PB 560呼吸机设计方案(包含原理图+PCB+BOM表+CAD)
  16. 万有引力的意思_万有引力的本质是什么?
  17. tkinter中控件menu的两种组织方法
  18. 文字,字体,图像,列表
  19. java中斜杠/和反斜杠\
  20. 如何查看eclipse是32位还是64位

热门文章

  1. 【洛谷P3804】统计每个子串出现的次数和长度(后缀自动机模版+拓扑序计数)
  2. mysql btree面试_java面试题:你了解mysql的B+TREE索引吗?
  3. wordpress如何整合html语言,怎么用wordpress建中英文双语及多语言切换的网站
  4. 怎么批量调色_100款一键批量商业影楼修图调色PS动作,让你成为P图高手!!
  5. 二分从查找(2)按条件查找
  6. 自动驾驶1-2 欢迎来到课程 Welcome to the Course
  7. React Native之原理浅析, iOS原理分析与实践解析、Android原理分析与实践解析
  8. Transformer-XL、Vanilla Transformer
  9. 480.滑动窗口中位数
  10. 重载前自增运算符和后自增运算符