Append the contents of one file to another

I often have to append a file to another file, usually when I’m adding a new key to a server’s authorized_keys file. So, here’s an example…

small_file.txt contains the following text:

my secret key

large_file.txt contains the following text:

some other secret key

To append the contents of small_file.txt to large_file.txt run the following command:

cat small_file.txt >> large_file.txt

That will result in the contents of large_file.txt looking as follows:

some other secret key
my secret key

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s