🐧 Linux / Shell Scripting
Beginner
How do you create a new file in Linux?
Answer
Several methods exist. touch filename creates an empty file or updates the timestamp of an existing one. echo "content" > filename creates a file with content (overwrites if exists). echo "content" >> filename appends to a file. cat > filename lets you type content interactively (Ctrl+D to save). Text editors like nano filename, vim filename, or gedit filename also create files on save. printf "line1\nline2\n" > filename writes formatted content.