Opening first few lines of a huge file with VS Code — Alex Brown

Alex Brown
Jul 15 · 1 min read

I’m currently doing some work looking at the GeoNames dataset.
allCountries.txt is around 1.5gb, which is pretty large, and certainly too large to open up in vscode for a quick look.

However, I found I could use command, which reads the first n lines of a file, and pipe the output to code - (which is the command for opening vs code and reading the output from another program)

For example:

$ head -3 allCountries.txt | code -

This opens the first 3 lines of allCountries.txt in vs code. Handy!

Originally published at on July 15, 2019.

Alex Brown

Written by

Freelance / contract .net developer

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade