Linux systems install the vi editor
Open the terminal type:
sudo apt install vim
Then wait for the installation can be input Y
That use the vi editor in Linux systems
After installing vim, vim input terminal to enter vim editing interface (or input "vi filename" open the file named "filename") is, when the cursor is in the bottom row, this time in the command line:
Press "a" or "i" key to enter the "Insert Mode" Edit Start
( "Insert Mode" press the ESC key into the command line)
command | Mode of operation |
---|---|
:q | Vi quit the program, if the file is modified, you must save the file |
:q! | Force Quit vi without saving the file |
:w | Save the file, but do not quit vi |
:w | For read-only file, save the contents of mandatory changes, but does not exit vi |
:wq | Save the file and exit vi |
:w filename | Save the file as a filename, do not quit vi |
:w!filename | Forced Save as file filename, do not quit vi |
:x | Save the file and exit vi, with wq |
:x! | Force Save the file and exit vi |
:s/p1/p2/g | The cursor string p1 p2 replace the current line |
:%s/p1/p2/g | String p1 p2 replace all lines |
:g/p1/s//p2 | String p1 p2 replace all lines |
:num1,num2 s/p1/p2/g | String p1 rows num1 num2 to replace p2 |
:/ | String lookup function with ": / String" can search string, "F" key rearward, "N" key forward |
Compile and run C programs under Linux system
If the system does gcc editor input terminal
sudo apt install gcc
Install gcc Editor
Then use the cd command in the terminal into the path where the C language program, input
(Assuming that a program named "Test.c")
gcc Test.c -o Test
or
gcc -o Test Test.c
Programs can be compiled
Then enter
./Test
You can run the program
Continually updated. . . . . .