How to Create a File in Linux

How to Create a File in Linux

linux bash

A simple way to create a file in Linux. I can be empty of have a line of text, or multiple lines - you are all covered.

Create an empty file

touch file.txt

Create a file with text

echo "Some text" > file.txt

Create a file with multiline text

cat <<EOF > file.txt
line1
line2
line3
EOF

Articolul anterior Următorul articol