Linux single-line script command collection this article will recently used some of the more interesting and powerful single-line commands to sort out, saving space is not an example. New updates will be found in the future. Www.2cto.com # export help documentation man ls | col-B> ls.man.txt # view the Union of file1 and file2 cat file1 file2 | sort | uniq # view the intersection of file1 and file2 cat file1 file2 | sort | uniq-d or comm-12 11.dat 22.dat # Check that only one-side sets of file1 and file2 exist cat file1 file2 | sort | uniq-u www.2cto.com # view the set comm that only exists in file1 -23 file1 file2 # view the set comm-13 file1 file2 that only exists in file2 # display the top 10 most occupied files or directories in the current directory: du-sh * | sort-nr | head # find up to 10 files in the current directory (including subdirectories. -type f | xargs ls-l | awk '{print $5 "" $9}' | sort-nr | head # locate the current directory (including subdirectories) the latest 10 files find. -type f | xargs ls-lt | head # extract all variables in the expression (remove duplicates) echo '(int1-2) /100 * int1 + int2 * int3' | \ tr' \ (\) \ + \-\ * \/''' |\# Delete the symbol :() +-*/sed-re's/\ B [0-9] + \ B // G' | \ # delete a number (excluding numbers in variables) tr ''' \ n' | \ sed '/^ $/d' | \ sort-u # Count the actual number of lines in the C language program (excluding comment lines and empty lines) cat xxx. c | \ sed '/^ [\ t] * \/\ */,/. * \/d '| \ # delete/**/sed'/^ [\ t] * \/d '| \ # delete // sed '/^ [\ t] * $/d' | \ # Delete empty row wc-l