Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to view huge txt files in Linux? [closed]

Tags:

linux

editor

I have got a 4 GiB txt file that I need to view.

When I try open it in Gedit it loads for a while then crashes.

Have you any ideas of a text editor that I can use to view this file. My OS is Fedora 20.

like image 809
user3213163 Avatar asked Jan 21 '14 00:01

user3213163


People also ask

How do I open a very large text file in Linux?

You can start Midnight Commander from the CLI with the mc command. After that you may select and open any file in "view mode" ( F3 ) or in "edit mode" ( F4 ). mc is much more efficient when opening and browsing large files than vim . I checked it myself.


Video Answer


3 Answers

BEHOLD! Since glogg looks unmaintained klogg is better alternative nowadays

apt install klogg

Try glogg. It worked great for me.

Debian:

apt-get install glogg

Fedora:

yum install glogg
like image 128
voy Avatar answered Oct 05 '22 01:10

voy


Not text editors, but in the command line tail -n 100 ./file.txt will give you the last 100 lines of a file, head -n 100 ./file.txt will give you the first 100 lines.

vim in the command line buffers as you read through a file (it doesn't open it in one go) so it's quite effective too.

like image 26
thelastshadow Avatar answered Oct 05 '22 00:10

thelastshadow


You can install Midnight Commander.

Debian, Ubuntu, etc.:

apt-get install mc

Red Hat, CentOS, Fedora, etc.:

yum install mc

You can start Midnight Commander from the CLI with the mc command. After that you may select and open any file in "view mode" (F3) or in "edit mode" (F4).

mc is much more efficient when opening and browsing large files than vim. I checked it myself.

If you want to watch a very large file in your favorite editor, without worrying about the limitations associated with RAM, I suggest you split the file using the split command:

split -n 8 [FILE_NAME]

The above cammand splits the file into 8 parts.

Of course, this solution will only check for some applications. Note that not every file retains its consistency after the division (e.g. XML does not). It all depends on what you want to do with the given file.

like image 16
simhumileco Avatar answered Oct 05 '22 00:10

simhumileco