• Skip to primary navigation
  • Skip to content
  • Skip to footer
Apesurd Apesurd ... tuning in
  • Blogs
  • CheatSheets
  • BookSummaries
    1. Home
    2. /
    3. Cheatsheets
    4. /
    5. Linux
    Mayank Saraswat

    Mayank Saraswat

    Programming, Music, Quantitative Finance and Machine Learning.

    • _apesurd
    • LinkedIn
    • GitHub
    • Goodreads
    • Email
    • Instagram

    Linux

    less than 1 minute read

    On this page

    • Finding file satisfying a pattern
    • Deleting files recursively
    • Writing text to a file from terminal
      • Single line
      • Multi line

    Finding file satisfying a pattern

    find {dir} -type f -name <filepattern>
    

    Deleting files recursively

    find {dir} -type d -name "subdir_name" -exec echo rm -rf {} \;
    

    Writing text to a file from terminal

    Single line

    echo "Content goes here" > filename
    

    Multi line

    cat << EOF > filename
    line1 
    line2 
    EOF
    
    Previous Next
    • X
    • GitHub
    • Instagram
    © 2025 Apesurd. Powered by Jekyll & Minimal Mistakes.