linux练习题1

test1:

linux练习题1

answer:















test:

linux练习题1

answer:

1.date +%H:%M:%S >/mnt/time.txt
2.head -n 18 passwd|tail -n +15
####head、tail####
1.一般用法:
显示前6行内容
head -n 6 filename
显示最后6行内容
tail -n 6 filename
2.扩展用法:
显示除了最后6行的全部内容
head -n -6 filename
从第5行开始显示文件
tail -n +5 filename

3.find /bin/*[[:upper:]]*
  find /bin/*[[:upper:]]* >bin_westos_file.txt|cat bin_westos_file.txt|wc -l
####wc####
[[email protected] mnt]# wc passwd
 38   66    1917   passwd
行数 单词数 字节数 文件名

4.[[email protected] ~]$ find /etc -name passwd 2>/dev/null
5.[[email protected] ~]$ find /etc -name passwd >/tmp/westos.out 2>/tmp/westos.err
6.[[email protected] mnt]$ find /etc -name passwd 2>&1|tee /tmp/westos.all