find:
find . -type d -print
find . ! -name "*.txt" -print
find . -type f "*.php" ! -perm 644 -print
find . -type f -name "*.php" -perm 644 -print
find . -type f -name "*.swp" -delete
find . -type f -size +2k
find /home/effaae/ -name "*.txt" -print
find . -iname "example*" -print
find .\(-name "*.txt" -o -name "*.pdf" \) -print
find /home/users -path "*aeea*" -print
find . -maxdepth 1 -type f -print
find . -mindepth 2 -type f -print
find . -type f -amin +7 -print
find . -type f -user Benjamin -print
find . -type f -user root -exec chown Benjamin {} \;
find . -type f -name "*.c" -exec cat {} \;>all_c_files.txt
xargs:
cat file.txt | xargs
cat file.txt | xargs -n 3
echo "splitXsplitXsplitX" | xargs -d X
cat args.txt | xargs -n 1 ./cecho.sh
find . type f -name "*.txt" -print0 | xargs -0 rm -f
tr:
echo "JOENONOE" | tr 'A-Z' 'a-z' 或 tr '[:upper:]' '[:lower:]'
cat text | tr '\t' ' '
echo "hello 123 world 567" | tr -d '0-9'
tr -s ' '
sort:
sort -n file.txt
sort -r file.txt
sort -k 2 data.txt
uniq:
uniq只能用于排过序的数据输入。
uniq sorted.txt #消除重复的内容
sort unsorted.txt | uniq 或 sort -u unsorted.txt
sort unsorted.txt | uniq -c #统计各行在文件中出现的次数。
sort unsorted.txt | uniq -d #找出文件中重复的行