Important Linux Command Tricks

Important Linux Command Tricks

  1. cat : concatenate

    cat > amit.js

    would create new file, ❗❗ BUT, if same file then rewrite.

    cat >> amit.js

    will give prompt to write something new, and will append to current file.

    Note: ❗❗❗

    \> : means rewrite

    \>> : means append at the end

    so, cat amit.js somefile.js > newfile.js

    would create new file with contents of amit.js and somefile.js.

  2. grep : find strings within text files

    grep "something" filename.txt

    would return places where it matches WITHIN FILE

    grep "something" -R ./

    will return all matching strings with files in current directory.