Subscribe to RSS Feed

terminal-logo-smallThis is a very typical case, the need to create a temp file on the command line quickly. Opening editor, writing content, save file and quit editor is not the fastest possible way. A faster way is to use the cat command with the name of the file and write contents of the file and give the end-of-file character (Ctrl-D).

Create Temporary File Without Editor on Command Line

# Create file
$ cat > /tmp/temp_file_name.txt
some content
more content
and even more content
<Ctrl-D>
 
# View file content
$ cat /tmp/temp_file_name.txt
some content
more content
and even more content

Append to Temporary File Without Editor on Command Line

# Append to file
$ cat >> /tmp/temp_file_name.txt
append content
append more content
append even more content
<Ctrl-D>
 
# View file content
$ cat /tmp/temp_file_name.txt
some content
more content
and even more content
append content
append more content
append even more content

Very easy, quick and usefull!

Bookmark & Share

Wondering what to do next?

Grab My Feed

Subscribe to RSS Feed

Catch Me On Twitter

Catch Me On Twitter!

Sponsors


Leave a Reply