Delete vi Edit exception generation. Test.java.swp Document Method

Source: Internet
Author: User

Delete vi Edit exception generation. Test.java.swp Document Method

When opening a Test.java file with VI or VIM under Linux

[Email protected] tmp]# VI Test.java

The following information appears:

E325:attention

Found a swap file by the name. TEST.JAVA.SWP "owned By:root dated:wed Dec 713:52:562011 file name:/var/tmp/test.java

Modified:yes

User Name:root host Name:localhost

Process id:26153 (still running)

While opening file "Test.java" dated:wed Dec 714:00:462011 newer than swap file!

(1) Another program may editing the same file.

Ifthis is the case, being careful not to end

Different instances of the same file when making changes.

Quit, orcontinue with caution.

(2) An edit session Forthis file crashed.

Ifthis is the case, use ": Recover" or "vim-r Test.java" to recover the changes (see ": Help Recovery").

If you do this already, delete the swap file ". TEST.JAVA.SWP "to avoid this message.

"Test.java" 11L, 237C

Press ENTER or type command to continue

The reason is that the VI or vim before the operation of the use of VI or VIM operation Test.java file when an abnormal interruption, so in the current directory produced a. Test.java.swp file, this file using the LS command to view can not be found, using LS- A command view can know that TEST.JAVA.SWP is a hidden file.

Note: Files that begin with. are hidden files

To remove the above warning prompt, delete the file:

[[Email protected] tmp]# RM. Test.java.swp

Rm:remove regular file '. Test.java.swp '? Y

[Email protected] tmp]#

You can use VI or vim to edit other files in a similar manner as possible. 5chmod command Explanation

The Linux chmod command is one of the most commonly used commands in daily operations, which is important for file management, such as setting up a Web directory with specific permissions to ensure server security.

Tip: After writing the shell script, we generally need to set permissions on this script: chmod a+x shell.sh

There are a lot of people, especially engaged in the development of programmers, do not understand the permissions, the program and directory directly to give Chmod-r 777 file, this highest level of permissions on the server security will cause great security risks, generally not recommended such settings, on-line server, configurable Chown to set the Web directory permissions, such as the user upload the picture directory is set to the Web execution user's permission, the need to use the program to operate the Web directory, the same settings: Chown-r Apache:apache Web, other read-only files or directories, to maintain root permissions, which can increase server security

Linux command: chmod

Usage rights: All users

Mode of use: chmod [-CFVR] [--help] [--version] Mode file ...

Description: Linux/unix file invocation permissions are divided into three levels: File owner [owner], group, other users. Chmod can be used to control how files are called by others.

Commands related to chmod: Chown,umask,

Parameters:

Mode: Permission set string in the following format: [Ugoa ...] [[+-=][RWXX] ...] [,...], where

U represents the owner of the file [user],

G means that the owner of the file belongs to the group,

o means other users [other],

A means that all three are [all]. Common

+ indicates increased permissions, (common)

-Represents the Cancel permission, (common)

= Represents a unique set of permissions.

R indicates a readable permission.

W indicates a writable permission.

X indicates an executable permission,

X means only if the file is a subdirectory or the file has been set to be executable.

-C: If the file permission has changed, it will not show its change action

-F: Do not display an error message if the file permissions cannot be changed

-V: Show details of permission changes

-r: Same permission change for all files in current directory and subdirectories (common)

--help: Display Help

--version: Display version

R=4,

w=2,

X=1

The rwx attribute is 4+2+1=7;

The rw-attribute is 4+2=6;

The R-x property is 4+1=5.

[email protected] linux]# LL

Total 8

Drwxr-xr-x 2 root root 4096 Apr 14:50 linuxyw

-rw-r--r--1 root root (APR) 23:40 linuxyw.com

-rw-r--r--1 root root 0 Apr 14:46 www.linuxyw.com

Example: Modify all read-only permissions for a file:

chmod ugo+r linuxyw.com

Or

chmod a+r linuxyw.com

Modify all executable permissions for the file for everyone:

chmod a+x linuxyw.com

Modify all files to be the primary user executable permission:

chmod u+x linuxyw.com

Set the files in the Linuxyw directory to everyone's executable permissions:

Chmod-r a+x linuxyw/

Set all the files in the Linuxyw directory to 755 permissions:

Chmod-r 755 linuxyw/

To cancel all file writable permissions under the Linux directory:

Chmod-r a-w linuxyw/

First look at the file permissions format first look at the file's permission format

[email protected] linux]# LL

Total 8

Drwxr-xr-x 2 root root 4096 Apr 14:50 linuxyw

-rw-r--r--1 root root (APR) 23:40 linuxyw.com

-rw-r--r--1 root root 0 Apr 14:46 www.linuxyw.com

LL's results return seven columns, respectively, indicating the following meanings:

First column [File properties]

second column [Number of files]

third column [owner]

Column four [owner Group]

Column five [size]

Column six [Filing date]

Seventh column [file name]

Our permission to set the file is this is the file attribute in the first column.

File properties There are 10 fields in this block, such as: Drwxr-xr-x

We divide these 10 columns into 4 pieces: [d] [rwx] [r-x] [r-x]

The first block: The first column, which represents the type of the file, has the following values:

(1) [d] is the directory, I am here is D, represents a directory

(2) [-] is the document;

(3) [L] is indicated as a link file (link file);

(4) [b] shall be indicated as an interface device for storage in the installation document;

(5) [C] is indicated as a serial port device inside the device file, such as a keyboard, mouse.

Second block: The 2nd to 4th column, which represents the permissions of the owner of the file.

The third block: the 5th to 7th column, which indicates the rights of the owner and the group.

Block four: The 8th to 10th column, which represents the rights of the non-owner group.

These permissions are represented by [rwx] three parameters, respectively, and correspond to different positions. Each block consists of 3 columns, and each column corresponds to a value. [R] stands for readable, [W] stands for writable, [x] stands for executable.

Example: If the owner has only read-only permissions, then the 2nd to 4th column is [r--], and the permission to read and write is [rw-], and the right to read and write and execute is [rwx].

The command format that uses digital weighting is as follows:

CHMOD ABC filename

The ABC represents 3 numbers, respectively, and corresponds to a different group of genera. That

The number a corresponds to the 2nd to 4th bit, which indicates the owner's permissions.

The number B corresponds to the 5th to 7th bit, which represents the permissions of the same group of users.

The number C corresponds to the 8th to 10th bit, which represents the permissions of the other groups.

rwx corresponds to 4,2,1. Then the read-only permission is denoted by 4 [r--], read-write with 6 (4+2) for [rw-], and write-and-execute 7 (4+2+1) for [rwx]. Read-only plus execution with 5 (4+1) indicates [R-x].

Example:

chmod 755 File1

chmod 777 file1 <==> chmod a=rwx file

chmod 771 file <==> chmod ug=rwx,o=x file

Delete vi Edit exception generation. Test.java.swp Document Method

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.