Opening first few lines of a huge file with VS Code

O

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 head 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!