导读 | 前面使用的命令,有几个用到了参数如ls -l, head -n 6等,需要注意的是命令跟参数之间要有空格。 |
获取可用命令行参数
终端运行man ls可以查看ls所有可用的参数,上下箭头翻页,按q退出查看。(man: manual, 手册)
ct@ehbio:~/data$ man ls name ls - list directory contents synopsis ls [option]... [file]... description list information about the files (the current directory by default). sort entries alphabetically if none of -cftuvsux nor --sort is specified. mandatory arguments to long options are mandatory for short options too. -a, --all do not ignore entries starting with . -a, --almost-all do not list implied . and .. --author with -l, print the author of each file -b, --escape print c-style escapes for nongraphic characters ....
文件上下翻转和左右翻转
两个有意思的命令,tac: 文件翻转,第一行变为最后一行,第二行变为倒数第二行;rev每列反转,第一个字符变为最后一个字符,第二个字符变为倒数第二个字符。
ct@ehbio:~/data$ cat <>first > second > third > end third second first ct@ehbio:~/data$ cat <> abcde > xyz > end edcba zyx