How To Open Big Size File Using VI Editor?

0 comments

How to Open/edit large files using VI?
Ans : Some time you will get message like file is too large to open with VI editor or some sort of other error messages like. 

For Example : Warning: Tmp file too large
 

This doesn't mean that you don't have enough space to open the file in /var/tmp (this is default VI editor temp location). This is because VI is having limitation in opening big files which is more than 9070000 character or file of size 2GB.
This is a warning message you get from vi (i.e. the ex family of editors) that it can not track your changes in the temporary files, the editor maintains during an edit session. So when ever using VI editor remember following things(These are from VI editor manual).


1.If the editor crashes (i.e. system halts, or accidental process termination), a preserve file cannot be created and you will not be able to recover your changes via the recover feature(vi -r filename is used to recover a file from .swp file).

2.In addition, while editing a very large files and vi fails to come up in visual mode, do not write this file (:w) since it may be truncated/crashed. You should quit (:q!) and open the file with csplit utility to divide the big file into smaller smaller files and edit(I dont suggest this as it is very much advanced to normal users).


3.To open files less than 2GB use following procedure
Step1 : Just execute vi command with out any file
#vi


Step2 :
In the command mode,
type :set directory="any directory with enough free space"

Step3 :
Now open the file using
:e "file name"
And start editing it. Once you are done you can save and exit(:wq).

Through this way we can avaoid vi crashing.
Some utilities which is used to view large files are.
a.cat filename more
b.tail filename

c.head filename
d.more filename
e.less filename

To open a file at desired line
head -n filname tail -1


Please comment your thoughts regarding this post:-)

  • Like the post? Please Subscribe to free RSS feed to get updates
  • Some interview topics

    2 comments

    If you are preparing for interviews for linux admin jobs you should be familiar with below concepts..

    1) Port number of different servers {cat /etc/services}
    2) Linux Installation(through FTP,HTTP,NFS)
    3) Boot process
    4) Diff b/w ext3 and ext2
    5) RAID LEVELS and Selection of raid
    6) backup methods
    7) Package management such as Yum server
    8) Kernel Tuning
    9) IPTABLES
    10) TCP WRAPPERS
    11) DIFFERENT RUN LEVELS
    12) USER AND GROUP MANAGEMENT
    13) QUOTA SETTING(user and group)
    14) DIFF B/W CRON AND AT
    15) BASIC SHELL SCRIPTING
    16) Troubleshooting different issues.
    17) Tell me why we should hire you?
    18) DAILY ACTIVITES IN YOUR CURRENT COMPANY
    19) RECENTLY SOLVED CRITICAL ISSUE
    20) LVM (Very Imp)
    21) vertias Volume manager
    22) cluster basic like HAD , GAB , LLT , HEARTBEAT , CONFIG FILES , RESOURSE , SERVICE GROUPS etc
    23 ) kernel panic troubleshooting
    24) Process management
    25)Configuration part of NFS , NIS , Samba , DHCP , DNS,Apache, Sendmail etc.
    26)Remote administration experience.

    And many more depending on your job profile. You should know each topics what you mentioned in your resume . If you are not sure about anything , dont mention in your resume and your resume should reflect your skills.

  • Like the post? Please Subscribe to free RSS feed to get updates
  • SAMBA Server Configuration

    0 comments

    SAMBA(SMB server) is a file sharing server. Which is used to share files between Windows, Linux and Unix Systems. SMB(Server Message Block) is a proprietary protocol which is developed by Microsoft

    Lets see how we can configure SAMBA in Linux.

    Step1 : Create a directory where you want to keep data and share with other remote systems(either windows/Solaris/in fact any unix flavor etc).
    #mkdir /share1

    Step2 : Installing Samba server
    #yum install samba

    Step3 : Once we install Samba server, configure it using its main configuration file(/etc/samba/smb.conf)

    Step3(a) : Open smb.conf file and specify the work group where this server belongs

    #vi /etc/samba/smb.conf
    search for workgroup word and specify your work group name
    workgroup = windows-group.

    Why we require this workgroup?
    Ans : When windows user try to access any network resource they first try to access my network places and then search for workgroup then to server. So definitly we have to specify this workgroup entry in smb.conf file.

    Step3(b) : So now we have to give a name to this samba server, search for "server string" with out quotes then provide the samba server name(here that name is linux-share)

    server string = linux-share

    Step3(c):Now specify the share details, which folder you want to share. To whom you want to share? Goto last line of the smb.conf file specify your shared folder details as follows.
    [myshare]

    comment = "This is my Linux data want to share with my windows users"
    path = /share1
    valid users = user1 user2
    writable = no
    privatable = no
    browsable =yes.

    After giving this seven entries just save and exit the file.

    Let me explain each and every thing what we used here.
    a.[myshare] --This is my share name, so when ever any user accessed my samba server through network this will be visible as folder shared.
    b.comment -- This is just a comment, which will help to know what is this share for.
    c.path -- This is used to specify which folder on my samba machine to share.
    d.valid users --This will specifies which user is having access on this folder.
    e.writable --This will specify whether users are able to write or not, In this example the can just read the folder and copy.
    f.Privatable --This will indicate whether this folder is private or not.
    g.browsable -- This is used to specify whether the folder content is browsable or not.

    Step4 : Now create passwords for the users who are going to access this samba share remotely.

    #smbpasswd -a user1
    #smbpasswd -a user2

    Please specify the passwords for this 2 users and this passwords will be stored in /etc/samba/smbpasswd

    Step5 : check for the syntax for your smb.conf file if in case you did any mistake

    #testparm

    Step6 : Restart the samba service

    #service smb restart

    Step7 : Permanently on the smb service, So that after rebooting the system too our server will start running.

    #chkconfig smb on

    Please check my other post how to mount or see the SAMBA shares
    here

    Please comment your thoughts regarding this post:-)

  • Like the post? Please Subscribe to free RSS feed to get updates
  • Archive

    Translate this page

     

    The Linux Juggernaut | Copyright 2006-2009 Surendra Kumar Anne | Surendra's Home Page | Give us feedback how we are doing, Click here