Solved

File size is different in vi as opposed to when it is shown in the directory

Posted on 2007-03-22
2
161 Views
Last Modified: 2013-12-16
I have a Linux ascii text file. The size shows 234642925 when I do: ls -l. However, when I do a vi on it, at the bottom the size shows as 234642973C where C is the number of characters. Can you anybody tell me why?
0
Comment
Question by:soccerplayer
2 Comments
 
LVL 10

Accepted Solution

by:
ssvl earned 500 total points
ID: 18791786
by default, vi enforces the upper limit of 1,048,560 lines. If you have a file that has more lines than this, then you need to change this default value by starting vi using the -yNumber option. Following is an excerpt from the man page for -yNumber on Libra:
"-yNumber Overrides the maximum line setting of 1,048,560 with any value greater than 1024. You should request twice the number of lines that you require because the vi editor uses the extra lines for buffer manipulation."
0
 
LVL 2

Expert Comment

by:jaredcall
ID: 18812355
it may be that ls shows the file size on disk (including partially allocated blocks).  vi wouldn't care about that, just character count.
0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

How many times have you wanted to quickly do the same thing to a list but found yourself typing it again and again? I first figured out a small time saver with the up arrow to recall the last command but that can only get you so far if you have a bi…
The purpose of this article is to demonstrate how we can upgrade Python from version 2.7.6 to Python 2.7.10 on the Linux Mint operating system. I am using an Oracle Virtual Box where I have installed Linux Mint operating system version 17.2. Once yo…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now