(Created page with "== Using VI == '''vi''' (pronounced vee-eye) is the Unix standard text editor so affords editing the configuration files by hand. If you don’t know it yet, it can be a bit sur...")
m (Protected "Linux basics" ([edit=sysop] (indefinite) [move=sysop] (indefinite)))
Revision as of 12:51, 7 April 2012
vi (pronounced vee-eye) is the Unix standard text editor so affords editing the configuration files by hand. If you don’t know it yet, it can be a bit surprising. Actually, vi was created at a time when the keyboards did not have any arrow or insert keys. So there are two modes: the «open» mode and the «insert» mode.
The open mode affords moving the cursor. j, k, l, m move the cursor by one character. ctrl-f moves one page forward and ctrl-b moves one page backwards. w moves one word forward and b moves one word backwards. It is also possible to use the arrow keys.
i goes into insert mode before the cursor, a goes into insert mode after the cursor, and A goes into insert mode at the end of the line. o adds a line after the current line, and O adds a live before the current line. R goes into rewrite mode.
esc affords getting out of the insert mode.
c$ affords replacing the end of the line and d$ affords deleting the end of the line. cw affords replacing one word and dw affords deleting one word. dd affords deleting the current line.
:q affords quitting without saving. If the file has been modified, quitting must be forced by typing :q!. :x affords saving and quitting. If the file does not have the write rigths, saving must be forced by typing :x!. :w affords writing the text in a new file. If the new file already exists, writing must be forced by typing :w!.
:num affords moving to the line number num. :$ affords moving to the end of the file. :num1copynum2 affords copying the line number num1 after the line number num2. :num1mnum2 affords moving the line number num1 after the line number num2.
For detailed information, check the VIM Documentation. To enter special characters check the page on digraphs. To get rid of the message "skipping N old session files", delete files elvis*.ses in /var/tmp.
Useful linux commands
|chmod -R ppp ddd||recursively change permissions on file or directory.|
|chown -R uuu:ggg ddd||recursively change user:group ownership on file or directory.|
|chgrp -R ggg ddd||recursively change group ownership on file or directory.|
|command xxx | grep yyy||search for string yyy in output of command xxx.|
|find xxx -name yyy -print||find file yyy in in subdirectories of xxx.|
|ln -s existing new||create a symbolic link new to an existing directory or file.|
|ls -al||list the working directory, including files beginning with a dot.|
|man xxx||display the xxx command manual page.|
|more xxx||display file xxx with the possibility of moving up and down. less and most are similar commands.|
|mount -t ttt /dev/xxx /mnt/ddd||mount device xxx as type ttt under directory ddd.|
|(u)mount /mnt/ddd||(u)mount device ddd as specified in /etc/fstab.|
|ps -ef||list the running processes.|
|pwd||print working directory.|
|rm -r||remove file or directory recursively.|
|su -l uuuu||execute shell as another user. if -l is used an environment similar to what the other user would have had with a direct login is provided.|
|telinit n||go to the runlevel n (1=single-user, 3=multi-user, 4=graphical).|
|umask||edit /etc/profile to change the default umask value of 022 and set it to 027 (files not readable by other users), a good setting except when installing as root server software to be ran as a standard user account (permission issues).|
|vi||run the vi text editor.|
|Installing Slackware||Main Page||Configuration files|