#!/bin/bash# Find all files larger than 1MB in the current directory, write the file name to a text file, Count # # Find command, Parameters: path address, command arguments,-size n (find files of length N)-type F ( Find a type of file, F normal file) # Tee Command | pipe symbol passes the result of the first command to the second command # WC statistics command, Parameters:-L (count rows)findteeWC -L
#!/bin/bash# Purpose: Find/directory, file name starts with ABC 100 files, save to File # # forin loop # shell command substitution, anti-quote, save command execution result to variable # Find command parameters:-name"XXX"(Find the file name, you can use the wildcard character *) # Head Start command parameter:-N (shows how many rows) # output REDIRECT>> two x >>Delegate Append forFileNameinch`Find/-name"abc*"|Head-N -` Do Echo$filename >>Abcfile.txt Done
[Linux] Linux Shell Find Files