<
<<! ... !
>或>>
2>或2>>
&>
1将ls命令生成的/tmp目录的一个清单存到当前目录中的dir文件中
# ls -l /tmp >dir
2 将ls命令生成是/etc/目录的一个清单以追加的方式存到当前目录中的dir文件中
# ls -l /tmp >>dir
3将etc/passwd文件的内容作为wc命令的输入
# wc < /etc/passwd
4将命令随后输入的内容作为wc命令的输入
# wc <<!
>tianmo
>hello
>!
5获得apache软件包的安装文件清单并存入指定的文件
# rpm -ql apache >apache.list
6用ehco命令和输出重定向简历简单的文本文件
# ehco "my name is tianmo " >message.txt
7利用cat命令,here文档和输出重定向建立简单的文本文件
# cat <<! >here
<this text forms the content of the heredocument
<my name is tianmo
<!
8将命令myprogram的错误信息保存在当前目录下的err_file文件中
# myprogram 2> err_file
9将命令myprogram的输出信息和错误信息保存在当前目录下的err_file文件中
# myprogram &> err_file
管道(过滤性)
1以长格式递归的方式分屏显示/etc目录下的文件和目录列表
# ls -Rl /etc | more
2分屏显示文本文件/etc/passwd的内容
# cat /etc/passwd | more
3统计文本文件/etc/passwd的行数,字数和字符数
# cat /etc/passwd | wc
4查看是否存在lrj用户账户
# cat /etc/passwd |grep lrj
5查看引导信息中关于第1块网卡的信息
# dmesg | grep eth0
6查看系统是否安装了apache的软件包
# rpm -qa | grep apache
7解压缩tar名为xyz.tar.gz的软件包
# gzip -dc xyz.tar.gz | tar -xvf
8以排序方式查看Linux系统中目录的磁盘占据情况
# du -s | sort -n
9快速移动整个目录
# (cd /source/directory && tar cf - .) | (cd /dest/dirctory && tar xvfp -)
10把man的信息存为文本文件
# man bash | col -b > bash.txt
11只列子目录
# ls -F | grep /$
# ls -l | grep "^d"
12计算当期目录下的文件数和目录数
# ls -l * | grep "^-" | wc -l
# ls -l * | grep "^d" | wc -l
13显示文本文件中间的若干行
# tail +15 myalllist | head -3