The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

deleting a swap file

Discussion in 'General Discussion' started by CTC, Jan 18, 2007.

  1. CTC

    CTC Active Member

    Joined:
    Nov 29, 2006
    Messages:
    25
    Likes Received:
    0
    Trophy Points:
    1
    can someone please give me the command for deleting the a swap file.
    I must have opened it twice.

    Thanks in advance.
     
  2. CTC

    CTC Active Member

    Joined:
    Nov 29, 2006
    Messages:
    25
    Likes Received:
    0
    Trophy Points:
    1
    I found it

    Here is a how to if anyone else is a little green to linux.

    Common Vi Commands

    Press Key(s):* Function:
    I Insert text before the cursor
    A Insert text after the cursor
    : Switch to ex mode
    $ Go to last place on the line
    ^ Go to first place on the line
    W Next word
    B Previous word
    Shift-G Last line of the file
    20 Shift-G Go to line 20
    Y Copy. (Note: Y3W = copy 3 words; Y3J = copy 4 lines.)
    P Paste
    D Cut
    X Delete character under the cursor

    Basically i think i opened the file twice which created a .swp file.

    i had to type at the root
    rm .{your file name}.swp
    making sure that you have a copy of one of the working ones.

    Hope this helps someone else.
     
  3. joesixon

    joesixon Registered

    Joined:
    Dec 4, 2004
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Bangalore
    Ummm... found something interesting in FreeBSD. It creates the swap file in /tmp, like this

    /tmp/vi.recover/vi.vbCwQL
    /var/tmp/vi.recover/recover.aFZ0EE

    Would like to add few more details

    -n option: No swap file will be used. Recovery after a crash will be impossible. Handy if you want to edit a file on a very slow medium (e.g. floppy). Can also be done with ":set uc=0". Can be undone with ":set uc=200".

    vim -x -n test.txt

    the swapfile can be disabled with:

    :setlocal noswapfile

    For more details,

    http://www.vim.org/htmldoc/
     
Loading...

Share This Page