Solved

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

Posted on 2007-03-22
2
164 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

VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Little introduction about CP: CP is a command on linux that use to copy files and folder from one location to another location. Example usage of CP as follow: cp /myfoder /pathto/destination/folder/ cp abc.tar.gz /pathto/destination/folder/ab…
Google Drive is extremely cheap offsite storage, and it's even possible to get extra storage for free for two years.  You can use the free account 15GB, and if you have an Android device..when you install Google Drive for the first time it will give…
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.:
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.

815 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