Single line create file with content
cat, command-line, nano
Solution
You can use `"echo"` in bash. e.g.:
echo "some text here" > file.txt
If you don't want a new line character at the end of the file, use the `-n` argument:
echo -n "some text here" > file.txt
Problem
The OS is Ubuntu. I want to create `file.txt` in `/home/z/Desktop` where the content of the file is `some text here`. The first and usual way is run `nano /home/z/Desktop/file.txt` and type `some text here`. after that, press `ctrl+x`, press`y` followed by `Enter`. The second way is run `cat > /home/z/Desktop/file.txt`, type `some text here` and press `Enter` followed by `ctrl+c` I hope I can run single line of command to make it faster. I thought `xdotool` will work with the `cat` (the second way), but no, it not works