Upload
rodney-green
View
234
Download
1
Embed Size (px)
Citation preview
Vim Editor and Unix Command gcc compilerComputer Networks
Vim
Vim is a Editor installed in almost every version of the unix-like OS.
There are three mode in Vim: Normal, Edit, Command.
This overview will cover the simple use of Vim like open file, editing, saving, abort the editing.
If you want to know more , you can reference: http://linux.vbird.org/linux_basic/0310vi.php
Vim – environment setting
Vim can mark the syntax in different colors, which can enhance the efficiency of developing programs dramatically.
You can set the custom color scheme or cursor line in .vimrc file.
cd ~
vim .vimrc
Vim – environment setting
After typing vim .vimrc , you’ll be able to edit the .vimrc file (if you don’t have one before, the system will create one for you).
If you want the default color scheme , just type “syntax on” in the file and then save the file.
If you want more custom setting, you can reference here :
http://linux.vbird.org/linux_basic/0310vi.php#vim_set
Vim – file open and save
If you want to save or abort the editing , you have to enter the command mode of the Vim.
If you’re in edit mode , press ESC and then “shift+:”
If you want to save the file , enter wq
If you don’t want to save the file , enter q!
gcc compiler
gcc is a c compiler to compile the code you develop.
There are a few flags need to take care when you compile code.
If you use the pthread in your server, remermber to add –lpthread after your gcc command.
Ex: gcc –lpthread server.c
gcc compiler
You can also assign the name of executable file by –o flags
Ex. gcc –o server server.c
UNIX Command
pwd : show the location you're
ls: list all the file in the current directory
mv [filename] [path] : move the file to the given path
cp [filename] [path] : copy the file to the given path.
mkdir [path] : create a sub directory at the current directory.
UNIX Command
cd path : change the current location to given path
Ex: cd testDir ,
Note:
1.cd .. means go back to the parent directory
2. cd ~ means go to home directory