Third experiment Linux system user management and configuration VIM

Third experiment Linux system user management and configuration VIM

This work belongs courses Class links courses
This requires a job in which Operational requirements Links
Student ID - Name 17043111- He Hui Fan
Job learning objectives (1), learning Linux system user management. (2), and learn to use VIM configuration.


1, Linux User Management

Q: Why should avoid using the Linux system root user login?

A: Because the root has the highest authority in the system, such as when their misuse when logging in as root on the system may cause a lot of damage.

operating

(1) how to view the current user's information in three files related to the user's?

cat / etc / passwd | grep hhf # view the user hhf user profile 
cat / etc / group | grep hhf # View profile group of users hhf of
sudo cat / etc / shadow | grep hhf # view the user hhf password configuration file

Please briefly describe these three documents?

1) / etc / passwd file: User Profile

2) / etc / group file: user group profiles

3) / etc / shadow files: a configuration file password


(2) view the current user-related information id command

Please briefly describe the output?

uid = 1000 (hhf) #hhf user's user ID 
gid = group where group 1000 (hhf) #hhf user ID
gid number of adm = 4, cdrom number of gid = 24, sudo number of gid = 27, dip the number 30 gid =,
the plugdev the gid number = 46, Ipadmin number of gid = 116, sambashare number of gid = 126. root user are uid and gid = 0

(3) to create two accounts, an account for the test, the other account begins with a capital E add your own student number ending in four and two respectively account password and administrator rights, after the account set up, simple to switch accounts after a review of information, delete test accounts, leaving the other account, to prepare for subsequent operations.

a) Create an account

 

b) Set Password

 

c) set permissions

 

Please briefly describe the concept of user groups?

A: In the Linux system is a logical set of a user group with the same characteristics of the user.

d) switching the account

 

e) delete account

 


2.VIM simple configuration

a) switch to the newly created account reserved


b) VIM create a configuration file in the user's home directory .vimrc


c) Open the file and add the following

set number "display line number    
syntax on" syntax highlighting
SET cursorline      
SET ruler A "display scale   set showcmd" command input is displayed, see more clearly   set scrolloff = 3 "for 3 to move the cursor when the top and bottom of the buffer line distance   "Do scintillation set novisualbell (do not know)   SET% = F. statusline R & lt% H% m%% W \ [% the FORMAT = & {FF}] \ [% the TYPE = the Y] \ [the POS = L%,% v] [% p %%] \ % {strftime (\ "% d /% m /% y \ - \% H:% m \")} " status line displays the contents of   set nocompatible" VIM consistency removed, you must be " SET = UTF-fencs. 8, UCS-BOM, Shift-JIS, GB18030, GBK, GB2312, cp936 SET. 8 termencoding = UTF- SET. 8 encoding = UTF- SET = UTF-fileencoding. 8




















"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""

"""""新文件标题

""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""

"新建.c,.h,.sh,.java文件,自动插入文件头

autocmd BufNewFile *.cpp,*.[ch],*.sh,*.java exec ":call SetTitle()"

""定义函数SetTitle,自动插入文件头

func SetTitle()

  "如果文件类型为.sh文件

  if &filetype == 'sh'

      call setline(1,"\#########################################################################")

      call append(line("."), "\# File Name: ".expand("%"))

      call append(line(".")+1, "\# Author: hhf")

      call append(line(".")+2, "\# mail: [email protected] ")

      call append(line(".")+3, "\# Created Time: ".strftime("%c"))

      call append(line(".")+4, "\#########################################################################")

      call append(line(".")+5, "\#!/bin/bash")

      call append(line(".")+6, "")

  else

      call setline(1, "/*************************************************************************")

      call append(line("."), "   > File Name: ".expand("%"))

      call append(line(".")+1, "   > Author: hhf")

      call append(line(".")+2, "   > Mail: [email protected] ")

      call append(line(".")+3, "   > Created Time: ".strftime("%c"))

      call append(line(".")+4, " ************************************************************************/")

      call append(line(".")+5, "")

  endif

  if &filetype == 'cpp'

      call append(line(".")+6, "#include<iostream>")

      call append(line(".")+7, "using namespace std;")

      call append(line(".")+8, "")

  endif

  if &filetype == 'c'

      call append(line(".")+6, "#include<stdio.h>")

      call append(line(".")+7, "")

  endif

  "新建文件后,自动定位到文件末尾

  autocmd BufNewFile * normal G

endfunc

""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
set autoindent     "Automatic indentation set showmatchset smarttab" row and beginning of the segment with tabsSET noexpandtab "No spaces instead of tabsSET = shiftwidth. 4set softtabstop = 4" Unified indent. 4SET. 4 TabStop = "width of the Tab keySET cindent















set history = 1000 "History number of records set nobackup" prohibit generate temporary files the SET noswapfile the SET ignorecase "Search Ignore Case set hlsearch" search-by-character highlight the SET incsearch the SET gdefault "replace inline set langmenu = zh_CN .UTF-8 "language setting sET helplang = CN sET laststatus = 2" is always displayed in the status line filetype on "detect file type filetype plugin on" loading filetype widget filetype indent on "for a specific file type Loading related indent file set iskeyword + = _, $, @,%, #, - " a word with the following symbols are not divided wrap



























set linespace = 0 "inserted between characters of the number of rows of pixels set wildmenu" enhanced mode operation command automatically set backspace = 2 "that the backspace (Backspace) normal processing indent, eol, start other set whichwrap + = <,>, h, l "and the cursor backspace key allows the cross line boundaries set mouse = a" mouse can be used anywhere in the buffer (similar to double-clicking the mouse is positioned at office workspace) SET = Selection exclusive SET = selectmode Mouse, Key "Auto completion : inoremap (() <the ESC> I : inoremap) <Cr> = ClosePair ( ')') <CR> : inoremap {{<CR>} <the ESC> O : inoremap} < Cr> = ClosePair ( '}') <CR> : inoremap [[] <the ESC> I : inoremap] <Cr> = ClosePair ( ']') <CR> :inoremap " ""<ESC>i:inoremap ' ''<ESC>i
























ClosePair function (char)!
  IF getline ( '.') [COL ( '.') -. 1] == A: char
      return "\ <Right>"
  the else
      return A: char
  endif
endfunction The SET completeopt = longest, MENU " open the file type detection, add the phrase before they can use intelligent completion


d) Create and open a file ending in .c, such as vim helloworld.c

The new file should appear as follows

 

Guess you like

Origin www.cnblogs.com/hhfdeboke/p/12531227.html