Tag: Shell
1. Search for all files larger than 500 mb in the current directory, write these file names to a text file, and count the number of files.
Find/-size + 500 m-type F | tee/root/file.txt | WC-l or find/-size + 50 m-exec ls {}\;>/root/test.txt
2. Find 100 files starting with ABC in the directory/tmp, and save the first line of these files to the file new.
for filename in `find /tmp -type f -name "abc*"|head -n 100`dosed -n ‘1p‘ $filename >> newdone
3. check whether a file is a block or character device file. If it is copied to the/dev directory
read -p "input a file:" filenameif [ -b $filename -o -c $filename ]thencp $filename /dev/fi
4. Save all rows in file B but not in file a as file C and count the number of lines in file C.
[[email protected] ~]# cat a dddddddddssssssss3333333333333eeeeeeeeee[[email protected] ~]# cat bdddddddddd444444444tttttttttt[[email protected] ~]# grep -xvf a b | tee c | wc -l3
This article from the "from the Heart" blog, please be sure to keep this source http://fuquanjun.blog.51cto.com/5820068/1432400