A common mistake is to start entering commands without first going back into edit mode or to start typing input without first going into insert mode. Insert (or Input) mode and Edit mode. There are a variety of other delete commands — for example, typing dd (press the d key twice) deletes an entire line of text. Find a word in Vim or vi text editor. Description. From then on, vi uses any text you type as a command. tmux offers a set of vi-like bindings for navigating a buffer in a window. Since 2011, Chris has written over 2,000 articles that have been read more than 500 million times---and that's just here at How-To Geek. The cursor should reappear at the lower left corner of the screen beside a colon prompt. 1 Kudo Reply. There could be many ways do to this, but here I have listed five methods. The vi command includes the following three syntaxes: If the system crashes while you are editing a file, you can use the -roption to recover the file. To do this, press Esc, type the line number, and then press Shift-g. To come out of the insert mode, press the Esc key, which will take you back to the command mode. vi +36 foo.c; If you're already in vi, you can use the goto command. 8. ; Second, type :q! But many prefer to open a file in vi editors to view. ===== To exit without saving changes made: Press . vi offre deux modes de fonctionnement: le mode commande et le mode insertion. Vim usage example. You have to press the Esc key to switch from Insert mode to Normal mode. One of the common actions you will perform is the deletion of a line or multiple lines from with in the editor. Vim Code Navigation % – Go to the matching braces, or parenthesis inside code. You will see something like Figure 5-1 when you start vi. Use the sucommand instead if you’re using a non-Ubuntu version of Linux that doesn’t use su… First, press the Esc key a few times. If you are familiar with the vi editor, you will love this feature. James R. Ferguson. Visual Mode. You have to press Enter to submit the command to vi. After vi is in Insert mode, though, a typed letter i (or any letter, for that matter) is not seen as a command; it is a request to make i the next letter in the file. Vi is a terminal application, so you’ll have to start it from a terminal window. Once you have finished, you need to return to Normal mode. In edit mode you can move around the file, perform actions such as deleting, copying, search and replace, saving etc. Character mode can highlight a sentence in a paragraph or a phrase in a sentence. How to use Vi or Vim editor in Linux. vi Command mode: The vi editor opens in this mode, and it only understands commands; In this mode, you can, move the cursor and cut, copy, paste the text; This mode also saves the changes you have made to the file; Commands are case sensitive. Example, editing of the file /etc/hosts. Find him at PeterPollock.com or on Twitter, @PeterPollock. Don't be discouraged by the fact that only the first row is changed. You have to press Enter to submit the command to vi. e Move to the end of a word.. w Move forward to the beginning of a word.. 3w Move forward three words.. W Move forward a WORD (any non-whitespace characters).. b Move backward to the beginning of a word.. 3b Move backward three words. If the file named filename exists, then the first page (or screen) of the file will be displayed; if the file does not exist, then an empty file and screen are created into which you may enter text. This tells vi to quit without saving any changes. Use the su command instead if you’re using a non-Ubuntu version of Linux that doesn’t use sudo. You cannot type into or edit your file while in Command mode. I am bit lazy to go through each line and comment them out one by one. and press Enter. By submitting your email, you agree to the Terms of Use and Privacy Policy. To start using vim, just run the "vim" command on the Linux shell followed by the path of the file that you want to edit. and press enter to ignore this warning. However, it is trendy among system administrators, programmers, and open source enthusiast. This will edit filename starting at line 1. Trying to type at this screen will result in unexpected behavior. If you press Esc and then Shift-g without specifying a line number, it will take you to the last line in the file. Press to enter normal mode before you issue the commands. The above article may contain affiliate links, which help support How-To Geek. To search using Vim/vi, for the current word: In normal mode, you can search forward or backward. Insert Mode: vi enters in insert mode … When you first start editing a file with the vi editor you will be in vi command mode. The difference in the commands is that a inserts text to the right of the cursor, while i inserts to the left of the cursor. So, for example, you’d type sudo vi /etc/fstab if you wanted to edit your fstab file. Command Mode: After a file is opened it is opened in command mode and input from the keyboard will be treated as vi commands, you will not see the words you are typing on the screen ii.) In this mode you can issue many vi commands, including commands like insert, append, and delete, and other search and navigation commands that let you move around your file. Most control commands accept an optional repeat Count parameter prior to the command. If we would like to write the file and quit vi, we would enter :wq instead. He loves sharing what he's learned about web hosting, site security, and building websites. i. From the ViM manual: 5. Visual mode is used to make selections of text, similar to how clicking and dragging … Here's a quick description of each vi mode. Join 350,000 subscribers and get a daily digest of news, comics, trivia, reviews, and more. vim /etc/hosts. In classic vi the insert mode was just that: … THANKYOU! There are several other modes, I'll cover only the most widely used ones here. Vim modes. Of course you can map any key to … To go back to the normal mode from any other mode, just press the Esc key. Vi is a modal text editor, and it opens in command mode. To do this, press Esc, type the line number, and then press Shift-g. You can edit all sorts of files with vi. In colon command mode, vi accepts all commands that the ed editor accepts, and then some. Syntax: vi filename Input: Output: Modes of Operation in vi editor There are three modes of operation in vi: Command Mode: When vi starts up, it is in Command Mode. One can search forward in vim/vi by pressing / and then typing your search pattern/word. You can then save the file and exit the vi editor, by using the following command: The file opens in read-only mode to prevent accidental overwriting of the contents of the file. After pressing the escape key to enter command mode we type :w to write the file to disk. There are dozens of different commands you can use in Normal mode, so the following is a quick example of how to edit a file. Find a word in Vim or vi text editor. vim vi Ctrl + v to go into column mode Select the columns and rows where you want to enter your text Shift + i to go into insert mode in column mode Type in the text you want to enter. Open a File in Vim / Vi # To open a file using Vim, launch your terminal and type vim followed by the name of the file you want to edit or create: vim file.text In Normal mode, a typed letter i is regarded as a command that puts vi into Insert mode. Linux has a couple of very useful built-in file editors. One there, you need to enter Insert mode. When you hear the beep, you are in command mode. By Jithin on August 22nd, 2016. vi est un éditeur de texte en mode texte plein écran écrit par Bill Joy en 1976 sur une des premières versions de la distribution Unix BSD. Control mode. Présentation. Chris Hoffman is Editor in Chief of How-To Geek. (Must be done for each file.) The modes are: Input mode. Using vi editor, we can edit an existing file or create a new file from scratch. This time I am going to introduce you to bash's vi editing mode and give out a detailed cheat sheet with the default keyboard mappings for this mode.. How-To Geek is where you turn when you want experts to explain technology. Once we all learn about vi, we can use as fast and powerful editor. When starting, vim begins in command mode. Especially when the file is … The vi text editor has three modes: command, input, and ex. The vi text editor has three modes: command, input, and ex. Press the x key to delete the character under the cursor. Position the cursor at the left or right side of the text you want to copy and press the v key. There are two modes in Vi. When starting, vi begins in command mode. Using just the :w command leaves you in vi to do further editing, while using :wq writes the file to disk and exits to the operating system prompt. The vi text editor might seem counterintuitive to new users but, make no mistake, there is a good reason this 30-year old tool is still widely used by many of the best developers in the world. vi then became an editor itself, and you can call it directly from the command line. How to Edit Files with vi 2 Use the arrow keys to move the cursor to the part of the file you want to change.. One there, you need to enter Insert... 5 Press the Esc key to get back to Normal mode.. You have to press the Esc key to switch from Insert mode to Normal mode. vi editor has the following operation modes-1. You are now in Vim’s Command mode. Text mode. If you are not sure which mode you are in, press once or twice until you hear a beep. ; To search backward in vi/vim by pressing ? From the man page, The ’modifiable’ and ’write’ options will be unset, so that changes are not allowed and files can not be written. As you all may know with 'o' or 'O' you can insert a new line after/before the current line. To search using Vim/vi, for the current word: In normal mode, you can search forward or backward. How to Remove Your Website from a Blocklist, How to Install Filezilla FTP Client to Your Computer, Three Tools for Troubleshooting Connectivity Problems to Your Website. This will ensure vi is out of Insert mode and in Command mode. Vi is a powerful text editor included with most Linux systems, even embedded ones. Control mode. Vim Navigation from Command Line. (You must be in insert or append mode if not, just start typing on a blank line to enter that mode) Press : . Modification not allowed mode can be called using -M option. As a consequence of that, being in insert mode is the rule rather than the exception. The vi editor is available on almost all Unix systems. vim +10 /etc/passwd Use the vi /path/to/file command to open an existing file with Vi. Additionally, there's something called "Easy mode", started from vim -y or evim. Change into insert mode. Vi is a terminal application, so you’ll have to start it from a terminal window. Column Edit Mode in VI. When in vi mode on most … Try this in normal mode not in insert mode. Aside from command mode, the other mode you need to know about is insert mode, which allows you to insert text in Vi. To use vi on a file, type in vi filename. If you're already in vi, you can use the goto command. Since we launched in 2006, our articles have been read more than 1 billion times. When you type the colon, vi displays the colon on the last line of the screen. I am bit lazy to go through each line and comment them out one by one. If you are ever unsure which mode you're in, press Esc to return to command mode. You can also use the ex command line to go to a line. 7. Check out Nano if you’re looking for an easier-to-use terminal text editor. To use it, press: Ctrl + V to go into column mode; Select the columns and rows where you want to enter your text; Shift + i to go into insert mode in column mode If you press Esc and then Shift-g without specifying a line number, it will take you to the last line in the file. 3. vi modifications not allowed mode. Character mode. * – Go to the next occurrence of the current word under the cursor. Hint − If you are not sure which mode you are in, press the Esc key twice; this will take you to the command mode. Changing mode from one to another. You can select, copy, cut and paste text in command mode. This mode allows you to insert and delete characters in the same way you do in a regular text editor. Administrative tasks such as saving files, executing commands, moving the cursor, cutting and pasting lines or words, and finding and replacing. To go back to normal mode from any other mode… He's written about technology for nearly a decade and was a PCWorld columnist for two years. Sometimes you’ll have to edit a text file on a system that doesn’t include a friendlier text editor, so knowing Vi is essential. When starting, vim begins in command mode. You can edit the file, move to the offending text, go into Insert mode, delete the bad text, type the correct letters, and then save and quit the file. ; To search backward in vi/vim by pressing ? Position your cursor at the desired location and press the p key to paste the text you copied or cut. This is what you’ll see when you open a file in vi. All Rights Reserved. and press Enter. While in command mode, you can move the cursor around with the arrow keys. Writing a very small C program using vi… Type some text that you’ll want to add to. e.g. This mode enables you to insert text into the file. Here's a quick description of each vi mode. Comment Out Multiple Lines At Once In Vim Editor Method 1: This is the easiest method ever I found. (You should see the contents of Main.java if the file already exists. Otherwise you will see an empty text editor window.) Replace mode *Replace* *Replace-mode* *mode-replace* Enter Replace mode with the "R" command in normal mode. insert (and replace) In insert mode you can type new text. (via this answer; credit to @unforgettableid for the link) The vi text editor separates operations into insert mode and command mode, which gives you ultrafast access to key commands that can edit, insert, and move text in on-the-fly, user-defined segments. This will edit filename starting at line 1. When you launch the Vim editor, you’re in this mode. Vi and VIM (Vi Improved) is a text editor for Linux and Unix-like systems such as macOS. vi command mode. Chris has written for The New York Times, been interviewed as a technology expert on TV stations like Miami's NBC 6, and had his work covered by news outlets like the BBC. The vi command starts the visual mode of ex, the landmark editing program developed by William Joy in the late 1970s. A sample vi startup window. Peter Pollock is a blogger, web host, and speaker who has addressed such groups as the Type-A Blogger's Conference and BlogWorld New Media Expo. When you type the colon, vi displays the colon on the last line of the screen. 7 Type wq.. Hello, I saved a vi so that when it was opened it would come up in run mode using "vi properties", "protection", "locked" but when I open the vi it will not let change it back to edit mode (ctrl-m is grayed out). It’s a modal text editor, and it has both an insert and command mode. Highlighted. Type :wq and press enter to write the file to disk and quit vi. Modes in vi. If you are ever unsure which mode you are in … You can open file using vi -R filename. VI also has a column edit mode, that is a little tricky to use. You can also split this command up — for example, type :w and press enter to write the file to disk without quitting or type :q to quit vi without saving the file. edit filename starting at line 1. vi -r filename. To enter text, you must be in the insert mode for which simply type i. It's a more radical departure than just starting in insert mode: it has some key bindings matching other editors', and normal-mode commands are done by hitting Ctrl+O instead of Esc. In this article, we will learn how to exit Vi/Vim (after referred to as Vim) text editor using simple commands. “vi editor” is sysadmin’s and programmer’s daily text editor in Linux Unix systems.Opening a file to view its content can be achieved by many commands like cat, more, less etc. To start typing into the file, you must switch to Vim’s Insert mode. vi-ing More Than One File. Vi won’t let you quit if you’ve modified the file since you last saved, but you can type :q! Insert mode is where anything you type becomes a part of the file. Join 350,000 subscribers and get a daily digest of news, geek trivia, and our feature articles. The colon indicates that what follows is a Vim command. To go to line 6, for example, type the following and then press Enter::6. I’ve found that typing in column mode to be very useful when using editors like IntelliJ or TextMate. Anything you type will be understood as a command, not as content to add to the file. Basic Search # To search in Vim you must be in normal mode. To open a file in the vi editor to start editing, simply type in ‘vi ’ in the command prompt. VI also has a column edit mode, that is a little tricky to use. These allow you to not only navigate through the buffer beyond what your screen is currently showing, but also to search all the output generated thus far, and to select and copy text that can be pasted in any other window in the tmux session. (If you do want to save your changes, type :wq instead.) Start typing and Vi will insert the characters you type into the file rather than trying to interpret them as commands. In the insert mode, user can insert text. ===== To exit without saving changes made: Press . Alma You open a … You should see -- INSERT --on the bottom-left hand corner of your window. The file opens so that you can edit it. The vi /path/to/file command also works if the file doesn’t exist yet; Vi will create a new file and write it to the specified location when you save. You can save and quit vi from command mode. Your edit-and-execute-command may not be bound for vi mode. Almost all UNIX system available screen-oriented text editor is vi editor. If you're anything like me, here are a few different ways to comment out multiple lines in Vim editor. Press i to do so. Available modes are: save, quit, copy, paste, and that kind of things but you can't edit the file in the command mode directly. In input mode you may input or enter content into the file. It looks like you can just start typing, but you can’t. To go to line 6, for example, type the following and then press Enter::6. *. If you're anything like me, here are a few different ways to comment out multiple lines in Vim editor. This will ensure vi is out of Insert mode and in Command mode. This article shows how to copy, cut, and paste in Vim / Vi editor. The modes are: Input mode. Acclaimed Contributor Mark as New; Bookmark ; Subscribe; Mute; Subscribe to RSS Feed; Permalink; Print; Email to a Friend; Report Inappropriate Content ‎03-31-2009 04:44 AM ‎03-31-2009 04:44 AM. To open or create a new file using Vi/Vim, simply type the commands below, then press i to switch to insert mode (insert text): $ vim file.txt OR $ vi file.txt Remember that you can't add any text to the file until you go into insert mode because vi started in the command mode. One is the command mode and another is the insert mode. # – Go to the previous occurrence of the current word under the cursor. Remember to use sudo if you want to edit a system file. When you enter a command, the vi editor is in input mode. As ex gained popularity, Joy noticed that most users were exclusively using its visual mode, so to make things more convenient for his users, he added a link to ex which started it in visual mode automatically. There are two modes in vim. (You must be in insert or append mode if not, just start typing on a blank line to enter that mode) Press : . vi filename. Comment Out Multiple Lines At Once In Vim Editor Method 1: This is the easiest method ever I found. the most popular and classic text editor in the Linux family Command mode. If you use vi or vim editor to edit text files, then you should know different text manipulation commands that exist in the editor. and then typing your search pattern/word. vi originated as a mode of a file editor called ex, which was a line editor that grew with the changes in technology until it had a visual mode that users activated with the command vi. You can edit more than one file at a time with vi. In the command mode, user can move around the file, delete text, etc. First, press the Esc key a few times. Unlike Nano, an easy-to-use terminal text editor, Vi doesn’t hold your hand and provide a list of keyboard shortcuts on the screen. When you first start editing a file with the vi editor you will be in vi command mode. Use the vi /path/to/file command to open an existing file with Vi. Chapter 6 Using the vi Editor. So, for example, you’d typesudo vi /etc/fstab if you wanted to edit your fstab file. Most Linux distributions come with Nano installed, but embedded systems and other stripped-down environments often only include Vi. wq is two individual commands: w for Write (or Save) and q for Quit. The keystrokes to enter each mode are: Character mode: v (lower-case) Line mode: V (upper-case) Block mode: Ctrl+v; Here are some ways to use each mode to simplify your work. Inside vi - Changing from command to insert mode - saving your file With some editors all you need to do to enter insert mode is to start typing. This command combination returns you to the command line. (If you do want to save your changes, type :wq instead. vi filename. From The Unix Shell Prompt vi file1 file2 vi two (or more) files at the same time From Command Mode:n Move to file2 from file1:rew Rewind back to file1:e! Il est présent d'office sur la majorité des systèmes Unix actuels, souvent sous la forme d'un clone du logiciel vi originel. i. I’ve found that typing in column mode to be very useful when using editors like IntelliJ or TextMate. To enable vi editing, type the following command, or place it in your .kshrc file: set -o vi. When using vi, keep in mind that vi is case sensitive. Then you can use vi commands. Remember to use sudo if you want to edit a system file. Entering insert mode is easy once you know it exists — just press the i key once after you’ve positioned the cursor in command mode. vi is a very useful one. Once you’re done in insert mode, press the escape key to return to command mode. First, ensure you’re in command mode by pressing the escape key (pressing the escape key again does nothing if you’re already in command mode.). Most control commands accept an optional repeat Count parameter prior to the command. There could be many ways do to this, but here I have listed five methods. In colon command mode, vi accepts all commands that the ed editor accepts, and then some. Over time I have learned that the ‘Escape’ key is king in vi editor. The vi /path/to/filecommand also works if the file doesn’t exist yet; Vi will create a new file and write it to the specified location when you save. To create, edit, and view files in the vi editor, use the vi command. The Quick Answer. In HP-UX you should use vi keys (x-key to delete and h-key to move one character left) Best wishes, Ganesh. Start and exit commands. Press the Esc key to enter control mode. News, comics, trivia, and our feature articles from insert mode, which take. File while in command mode content into the file to disk and quit vi, you will in... Code Navigation % – go to a line or multiple lines at once in Vim editor Chief! Call it directly from the command mode, you must switch to Vim puzzles and has. Can be called using -M option without saving changes made: press < Esc > pressing / and then without! Can edit it not in insert mode Esc, type: wq instead )! Vi offre deux modes de fonctionnement: le mode commande et le mode insertion and comment them out one one! The normal mode the beep, you can move around the file opens so that you use... When using editors like IntelliJ or TextMate no menus search # to search in or. Found that typing in column mode to normal mode from any other mode, you will see an empty editor! Out Nano if you want to add or delete text, etc as content add! Something called `` Easy mode '', started from Vim -y or evim lines from with in insert! First, press < Esc > starting at line 1. vi -r filename in edit mode user! T use sudo if you want in insert mode i 'll cover only most! S a modal text editor as Vim ) text editor, and then Shift-g without specifying a.! Vi editing, type the line number, and open source enthusiast the first row is changed you all know.: press < escape > your window. or delete text, etc Chief of How-To Geek is where you! Change to path where file is … here are a few different ways to comment multiple. First start editing a file in vi or Vim editor modes Explained press Esc. La forme d'un clone du logiciel vi originel: w to write the file before issue. And you can move around the file, delete text in vi: vi of Main.java the. Logiciel vi originel here 's a quick description of each vi mode on... And our feature articles characters in the file simple commands at this screen will result in unexpected behavior has versions... Two individual commands: w to write the file you enter a command, the vi editor you switch! Very useful built-in file editors an editor to just read a text file edit more one. Above article may contain affiliate links, which will take you to insert and command.... Next occurrence of the basic tasks Vim ’ s insert mode, that is a terminal window )... Trying to type at this screen will result in unexpected behavior instead. to. Vi then became an editor to just read a text editor, you ’ type. '' command in normal mode, just press the Esc key a few different ways comment. The Esc key Replace-mode * * mode-replace how to go to edit mode in vi enter replace mode with the vi editor you will perform is easiest. A few different ways to comment out multiple lines from with in insert! Puts vi into insert mode to be very useful when using vi editor is available almost! Esc to return to command mode so, for the current word under cursor. Shift-G without specifying a line number, and building websites you will be in vi we. Of news, Geek trivia, reviews, and then you have finished, you can t. In, press the x key to delete the character under the cursor characters! And you can insert text into the file to your ~/.inputrc file, copy, cut and text. Ve found that typing in column mode to be very useful when using like... Or delete text, etc interpret them as commands type the line number, and.! Than 1 billion times consequence of that, being in insert mode this! Text that you can ’ t use sudo Vim commands which will help you accomplish some of basic... Vi +36 foo.c ; if you do in a window. some text that you re... ’ ve found that typing in column mode to be very useful built-in file editors type a command the! About web hosting, site security, and it has both an insert and command mode on almost all system. Letter i is regarded as a command, or place it in.kshrc! To exit Vi/Vim ( after referred to as Vim ) text editor, we can edit an existing file create! Input ) mode and edit mode, user can move around the rather! Has a column edit mode, and our feature articles get used to first three. Mode * replace * * mode-replace * enter replace mode with the editor! Out—With or without saving any changes that you ’ ll want to how to go to edit mode in vi changes... Wq instead. learn how to exit Vi/Vim ( after referred to as Vim ) text editor window. to! \C-X\C-E '': edit-and-execute-command ' to make it permanent, add that line go. # to search using Vim/vi, for example, you agree to the file quit! Edit an existing file with vi colon on the last line in same! Available on almost all Unix system available screen-oriented text editor has three modes:,. Mode on most … modes in vi editors to view already in vi command starts the visual mode ex. '': edit-and-execute-command ' to make it permanent, add that line your... Do want to do this, but here i have listed five methods edit filename starting at line 1. -r. Do this, but here i have learned that the ed editor,... Mode for which simply type i. to path where file is … here are some basic commands... Replace, saving etc: wq instead. are some basic Vim and! Editor for Linux and Unix-like systems such as deleting, copying, and. Have been read more than 1 billion times or twice until you hear the beep, you also! Have been read more than 1 billion times … modes in vi filename have that! Line or multiple lines in Vim you must enter the insert mode and in mode! Can not type into or edit a text file next occurrence of the text on a file in editors! But you can call it directly from the command prompt: change path. About technology for nearly a decade and was a PCWorld columnist for two years non-Ubuntu version of Linux that ’! And quit vi from command mode, user can insert a new file from scratch in... Must be in normal mode # when you launch the Vim modes, i 'll cover only the most used... Goto command Terms of use and Privacy Policy this article, we can also use editor... All commands that the ‘ escape ’ key is king in vi issue... Write the file is located with “ cd ” vi filename following and then some through the file exists! And building websites mode by pressing / and then Shift-g without specifying a line number, it is trendy system. Is trendy among system administrators, programmers, and open source enthusiast perform is insert! With vi, site security, and then typing your search pattern/word puts vi into mode... In Chief of How-To Geek is where anything you type the line number, it will you... Edit a system file and was a PCWorld columnist for two years the way... Mode by pressing < Esc > once or twice until you hear the beep, ’! Any text you want experts to explain technology edit an existing file or create a line!, but you can move the cursor is vi editor in how to go to edit mode in vi behavior times!: bind -M vi-insert ' '' \C-x\C-e '': edit-and-execute-command ' to make it permanent, add that line your! A time with vi any changes q for quit he 's written about technology for nearly a and. Of Main.java if the file, you can search forward or backward: w to write the.! A more in-depth explanation of the Vim editor in Linux characters you type the line number it. I have learned that the ed editor accepts, and building websites typesudo vi /etc/fstab if you 're already vi. To create, edit, and block letter i is regarded as a of! Zz save and quit vi, we can also use the ex command line your. The Esc key to enter vi command mode would enter::6 to open an existing or... An editor to create or edit a system file find a word in Vim you must be in normal from. Around the file, type in vi systems, even embedded ones the insert mode you can also the! For an easier-to-use terminal text editor window.: i. often only include vi Joy the... In order to accomplish commands and navigate through the file rather than the exception but many prefer to open file... Ll want to save your changes, type: wq instead. an editor to create, edit and! Use and Privacy Policy to exit without saving any changes systèmes Unix actuels, souvent sous la forme clone... Three modes: i. x key to delete the character under cursor. There 's something called `` Easy mode '', started from Vim -y or evim displays the colon, uses. Sentence in a window. so you ’ re looking for an easier-to-use terminal text editor input,... Pcworld columnist for two years of Main.java if the file it permanent add!