The Linux root directory lacks X permissions, resulting in two errors:
Execute the SystemCTL command as root to report permission related issues
[root@hps2 ~]# systemctl stop hps-manager
* (pkttyagent:10364): WARNING *: Unable to register authentication agent: GDBus.Error:org.freedesktop.DBus.Error.ServiceUnknown: The name org.freedesktop.PolicyKit1 was not provided by any .service files
Error registering authentication agent: GDBus.Error:org.freedesktop.DBus.Error.ServiceUnknown: The name org.freedesktop.PolicyKit1 was not provided by any .service files (g-dbus-error-quark, 2)
Switch from root to normal user and report an error:
[root@hps2 ~]# useradd aihps
[root@hps2 ~]# su – aihps
su: warning: cannot change directory to /home/aihps: Permission denied
su: failed to execute /bin/bash: Permission denied
The solution
Directory
Device: fd01h/64769d Inode: 2 Links: 23
Access: (0600/ DRW –) Uid: (0/root) Gid: (0/root) Gid: (0/root) Gid: (0/root) Gid: (0/root) Gid: (0/root) Gid: (0/root) Gid: (0/root) Gid: (0/root) Gid: (0/root) Gid: (0/root) Gid: (0/root) Gid: (0/root) Gid: (0/root) Gid: (0/root)
Access: 2016-05-30 09:54:45.692000000 +0800
Modify: 204000000 +0800
Change: 2016-05-25 15:41:46.204000000 +0800
Birth: –
problem, the permissions here are wrong, the loss of X permissions caused.
[root@localhost ~]#chmod 755/
modified, the problem goes away.
The operation that causes the above problem:
the first type, chmod 666 /, can cause.
or
the second, chmod 700 /lib/ ld-xxx. so, can also cause su to fail.
if you’re interested, try it out for yourself.
/the loss of permissions has the same effect on all daemons running on their own user identities.
Refer to the article: http://blog.itpub.net/9606200/viewspace-745674/
Tag Archives: linux
UnicodeDecodeError: ‘utf-8’ codec can’t decode byte 0xd6 in position 3089: invalid continuation byte
The cause of
New Ubuntu16.04LTS, then ctags+cscope+taghighlight. Cscope-rb, and then open the source input :UpdateTypesFile and you encounter the following error.
45 #define CREATE_TRACE_POINTS
46 #include <trace/events/asoc.h>
47
48 #define NAME_SIZE 32
49
50 #ifdef CONFIG_DEBUG_FS
51 struct dentry *snd_soc_debugfs_root;
52 EXPORT_SYMBOL_GPL(snd_soc_debugfs_root);
53 #endif
Error detected while processing function TagHighlight#Generation#UpdateAndRead[16]..TagHighlight#Generation#UpdateTypesFile[106]..TagHighlight#RunPython
Script#RunGenerator:
line 54:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/home/zz/.vim/plugin/TagHighlight/module/worker.py", line 52, in RunWithOptions
GenerateTags(config)
File "/home/zz/.vim/plugin/TagHighlight/module/ctags_interface.py", line 65, in GenerateTags
tagLines = [line.strip() for line in tagFile]
File "/home/zz/.vim/plugin/TagHighlight/module/ctags_interface.py", line 65, in <listcomp>
tagLines = [line.strip() for line in tagFile]
File "/usr/lib/python3.5/codecs.py", line 321, in decode
(result, consumed) = self._buffer_decode(data, self.errors, final)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xd6 in position 3089: invalid continuation byte
Press ENTER or type command to continue
Analysis:
1. There was no problem when browsing the same code on the server of the company. The temporary exclusion is the problem of the code. 2. Taghighlight and python would have been taghighlight and python, amateurish, but not vim. 3. Notice the last line of the error:
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xd6 in position 3089: invalid continuation byte
Say it’s a character cannot be resolved as utf-8, although the position is given, but don’t know is which files, is/usr/lib/python3.5/codecs. Py this file?I opened it up and I looked at it and I said, well, I don’t know, I’m not good at Python, I don’t see anything wrong. Then take this string to search on the Internet, no search to useful, they encounter is the source file itself has problems, modify their source code is good, but I encounter here should not be the source file problem, the reason in the above analysis also said. However, in the process of searching, I felt that the python version was a problem, so I checked the explanatory document of TagHighlight, and it did introduce the configuration of changing the Python version:
953 PythonVariantPriority TagHL-PythonVariantPriority
954 The python part of TagHighlight can be run in a number of ways,
955 depending on your system configuration. For most users, this should
956 be handled completely automatically, but if you want to customise
957 things, this option is the best way to start. There are currently
958 four supported python variants:
959
960 if_pyth3: When using this variant, the python code will be run
961 using the Python 3.x interface built into Vim. If using
962 a Vim that is compiled with +python/dyn and
963 +python3/dyn, be aware that this may cause problems if
964 you want to use the python 2.x interface. See the
965 details on case 4 under :py3file.
966
967 if_pyth: When using this variant, the python code will be run
968 using the Python 2.x (at least version 2.6 required)
969 interface built into Vim. See the comments above
970 regarding potential conflicts between the two python
971 versions.
972
973 python: When using this variant. the python code will be run
974 using the version of python that is in the path or
975 specified with the option TagHL-PathToPython.
976
977 compiled: When using this variant, the compiled executable version
978 of the python part of the plugin will be used (so no
979 system version of python is required). Note that this
980 requires the compiled version to be installed as it is
981 not part of the main distribution. See the installation
982 guide for more information: TagHighlight-install.
983
984 Option Type: List
985 Default: ["if_pyth3", "if_pyth", "python", "compiled"]
When I checked this again and again, I found that Vim also specifies the Python version when it is compiled, so I wanted to see the version of Vim in question:
zz@zzm:doc$ vim --version
VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Nov 24 2016 16:44:48)
Included patches: 1-1689
Extra patches: 8.0.0056
Modified by [email protected]
Compiled by [email protected]
Huge version without GUI. Features included (+) or not (-):
+acl +farsi +mouse_netterm +tag_binary
+arabic +file_in_path +mouse_sgr +tag_old_static
+autocmd +find_in_path -mouse_sysmouse -tag_any_white
-balloon_eval +float +mouse_urxvt -tcl
-browse +folding +mouse_xterm +terminfo
++builtin_terms -footer +multi_byte +termresponse
+byte_offset +fork() +multi_lang +textobjects
+channel +gettext -mzscheme +timers
+cindent -hangul_input +netbeans_intg +title
-clientserver +iconv +packages -toolbar
-clipboard +insert_expand +path_extra +user_commands
+cmdline_compl +job -perl +vertsplit
+cmdline_hist +jumplist +persistent_undo +virtualedit
+cmdline_info +keymap +postscript +visual
+comments +langmap +printer +visualextra
+conceal +libcall +profile +viminfo
+cryptv +linebreak -python +vreplace
+cscope +lispindent +python3 +wildignore
+cursorbind +listcmds +quickfix +wildmenu
+cursorshape +localmap +reltime +windows
+dialog_con -lua +rightleft +writebackup
+diff +menu -ruby -X11
+digraphs +mksession +scrollbind -xfontset
-dnd +modify_fname +signs -xim
-ebcdic +mouse +smartindent -xsmp
+emacs_tags -mouseshape +startuptime -xterm_clipboard
+eval +mouse_dec +statusline -xterm_save
+ex_extra +mouse_gpm -sun_workshop -xpm
+extra_search -mouse_jsbterm +syntax
system vimrc file: "$VIM/vimrc"
user vimrc file: "$HOME/.vimrc"
2nd user vimrc file: "~/.vim/vimrc"
user exrc file: "$HOME/.exrc"
fall-back for $VIM: "/usr/share/vim"
Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H -Wdate-time -g -O2 -fPIE -fstack-protector-strong -Wformat -Werror=format-security -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1
Linking: gcc -Wl,-Bsymbolic-functions -fPIE -pie -Wl,-z,relro -Wl,-z,now -Wl,--as-needed -o vim -lm -ltinfo -lnsl -lselinux -lacl -lattr -lgpm -ldl -L/usr/lib/python3.5/config-3.5m-x86_64-linux-gnu -lpython3.5m -lpthread -ldl -lutil -lm
zz@zzm:doc$
The obvious answer is that the version used is python3.5. A “+” in front of it means yes, and a “-” means no.
notice that python is preceded by “-” and python3 by “+”.
for comparison, check the vim version of the company’s server again:
zz@server5:~$ vim --version
VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Nov 24 2016 16:42:52)
Included patches: 1-52
Extra patches: 8.0.0056
Modified by [email protected]
Compiled by buildd@
Huge version with GTK2 GUI. Features included (+) or not (-):
+acl +farsi +mouse_netterm +syntax
+arabic +file_in_path +mouse_sgr +tag_binary
+autocmd +find_in_path -mouse_sysmouse +tag_old_static
+balloon_eval +float +mouse_urxvt -tag_any_white
+browse +folding +mouse_xterm +tcl
++builtin_terms -footer +multi_byte +terminfo
+byte_offset +fork() +multi_lang +termresponse
+cindent +gettext -mzscheme +textobjects
+clientserver -hangul_input +netbeans_intg +title
+clipboard +iconv +path_extra +toolbar
+cmdline_compl +insert_expand +perl +user_commands
+cmdline_hist +jumplist +persistent_undo +vertsplit
+cmdline_info +keymap +postscript +virtualedit
+comments +langmap +printer +visual
+conceal +libcall +profile +visualextra
+cryptv +linebreak +python +viminfo
+cscope +lispindent -python3 +vreplace
+cursorbind +listcmds +quickfix +wildignore
+cursorshape +localmap +reltime +wildmenu
+dialog_con_gui +lua +rightleft +windows
+diff +menu +ruby +writebackup
+digraphs +mksession +scrollbind +X11
+dnd +modify_fname +signs -xfontset
-ebcdic +mouse +smartindent +xim
+emacs_tags +mouseshape -sniff +xsmp_interact
+eval +mouse_dec +startuptime +xterm_clipboard
+ex_extra +mouse_gpm +statusline -xterm_save
+extra_search -mouse_jsbterm -sun_workshop +xpm
system vimrc file: "$VIM/vimrc"
user vimrc file: "$HOME/.vimrc"
2nd user vimrc file: "~/.vim/vimrc"
user exrc file: "$HOME/.exrc"
system gvimrc file: "$VIM/gvimrc"
user gvimrc file: "$HOME/.gvimrc"
2nd user gvimrc file: "~/.vim/gvimrc"
system menu file: "$VIMRUNTIME/menu.vim"
fall-back for $VIM: "/usr/share/vim"
Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H -DFEAT_GUI_GTK -pthread -I/usr/include/gtk-2.0 -I/usr/lib/x86_64-linux-gnu/gtk-2.0/include -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/pango-1.0 -I/usr/include/gio-unix-2.0/ -I/usr/include/freetype2 -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/libpng12 -I/usr/include/harfbuzz -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -I/usr/include/tcl8.6 -D_REENTRANT=1 -D_THREAD_SAFE=1 -D_LARGEFILE64_SOURCE=1
Linking: gcc -L. -Wl,-Bsymbolic-functions -Wl,-z,relro -L/build/buildd/ruby1.9.1-1.9.3.484/debian/lib -rdynamic -Wl,-export-dynamic -Wl,-E -Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,--as-needed -o vim -lgtk-x11-2.0 -lgdk-x11-2.0 -latk-1.0 -lgio-2.0 -lpangoft2-1.0 -lpangocairo-1.0 -lgdk_pixbuf-2.0 -lcairo -lpango-1.0 -lfontconfig -lgobject-2.0 -lglib-2.0 -lfreetype -lSM -lICE -lXpm -lXt -lX11 -lXdmcp -lSM -lICE -lm -ltinfo -lnsl -lselinux -lacl -lattr -lgpm -ldl -L/usr/lib -llua5.2 -Wl,-E -fstack-protector -L/usr/local/lib -L/usr/lib/perl/5.18/CORE -lperl -ldl -lm -lpthread -lcrypt -L/usr/lib/python2.7/config-x86_64-linux-gnu -lpython2.7 -lpthread -ldl -lutil -lm -Xlinker -export-dynamic -Wl,-O1 -Wl,-Bsymbolic-functions -L/usr/lib/x86_64-linux-gnu -ltcl8.6 -ldl -lz -lpthread -lieee -lm -lruby-1.9.1 -lpthread -lrt -ldl -lcrypt -lm -L/usr/lib
Looking at the server version again, the company server is Ubuntu 14.04.2lts (GNU/Linux 3.13.0-24-generic x86_64)
and my new one is 16.04, which is probably why 14.02 USES python2.7.
Python3.5 is supposed to be a bit more compatible than 2.7, but it turns out that python3.5 is more compatible than 2.7.
the next line of thought is clearer:
1. Either change my vim to use python2.7 as well; 2. Either install a python3.6 or later, and then figure out a way for vim to use this version;
obviously, method 1 is relatively easy to implement, and the way to add python2 to vim is as follows:
py2 package installed, under the command terminal input: sudo apt - get the install vim - nox - py2 code>
please see the specific link https://blog.csdn.net/u012629369/article/details/53447555
I do the same thing, can use python2 results vim:
zz@zzm:doc$ sudo apt-get install vim-nox-py2
[sudo] password for zz:
Reading package lists... Done
Building dependency tree
Reading state information... Done
Suggested packages:
vim-doc
The following NEW packages will be installed:
vim-nox-py2
0 upgraded, 1 newly installed, 0 to remove and 23 not upgraded.
Need to get 0 B/1,100 kB of archives.
After this operation, 2,642 kB of additional disk space will be used.
Selecting previously unselected package vim-nox-py2.
(Reading database ... 220112 files and directories currently installed.)
Preparing to unpack .../vim-nox-py2_2%3a7.4.1689-3ubuntu1.2_amd64.deb ...
Unpacking vim-nox-py2 (2:7.4.1689-3ubuntu1.2) ...
Setting up vim-nox-py2 (2:7.4.1689-3ubuntu1.2) ...
update-alternatives: using /usr/bin/vim.nox-py2 to provide /usr/bin/vim (vim) in auto mode
update-alternatives: using /usr/bin/vim.nox-py2 to provide /usr/bin/vimdiff (vimdiff) in auto mode
update-alternatives: using /usr/bin/vim.nox-py2 to provide /usr/bin/rvim (rvim) in auto mode
update-alternatives: using /usr/bin/vim.nox-py2 to provide /usr/bin/rview (rview) in auto mode
update-alternatives: using /usr/bin/vim.nox-py2 to provide /usr/bin/vi (vi) in auto mode
update-alternatives: using /usr/bin/vim.nox-py2 to provide /usr/bin/view (view) in auto mode
update-alternatives: using /usr/bin/vim.nox-py2 to provide /usr/bin/ex (ex) in auto mode
zz@zzm:doc$
zz@zzm:doc$
zz@zzm:doc$ vim --version
VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Nov 24 2016 16:44:48)
Included patches: 1-1689
Extra patches: 8.0.0056
Modified by [email protected]
Compiled by [email protected]
Huge version without GUI. Features included (+) or not (-):
+acl +farsi +mouse_netterm +tag_binary
+arabic +file_in_path +mouse_sgr +tag_old_static
+autocmd +find_in_path -mouse_sysmouse -tag_any_white
-balloon_eval +float +mouse_urxvt +tcl
-browse +folding +mouse_xterm +terminfo
++builtin_terms -footer +multi_byte +termresponse
+byte_offset +fork() +multi_lang +textobjects
+channel +gettext -mzscheme +timers
+cindent -hangul_input +netbeans_intg +title
-clientserver +iconv +packages -toolbar
-clipboard +insert_expand +path_extra +user_commands
+cmdline_compl +job +perl +vertsplit
+cmdline_hist +jumplist +persistent_undo +virtualedit
+cmdline_info +keymap +postscript +visual
+comments +langmap +printer +visualextra
+conceal +libcall +profile +viminfo
+cryptv +linebreak +python +vreplace
+cscope +lispindent -python3 +wildignore
+cursorbind +listcmds +quickfix +wildmenu
+cursorshape +localmap +reltime +windows
+dialog_con +lua +rightleft +writebackup
+diff +menu +ruby -X11
+digraphs +mksession +scrollbind -xfontset
-dnd +modify_fname +signs -xim
-ebcdic +mouse +smartindent -xsmp
+emacs_tags -mouseshape +startuptime -xterm_clipboard
+eval +mouse_dec +statusline -xterm_save
+ex_extra +mouse_gpm -sun_workshop -xpm
+extra_search -mouse_jsbterm +syntax
system vimrc file: "$VIM/vimrc"
user vimrc file: "$HOME/.vimrc"
2nd user vimrc file: "~/.vim/vimrc"
user exrc file: "$HOME/.exrc"
fall-back for $VIM: "/usr/share/vim"
Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H -Wdate-time -g -O2 -fPIE -fstack-protector-strong -Wformat -Werror=format-security -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1
Linking: gcc -L. -Wl,-Bsymbolic-functions -Wl,-z,relro -fstack-protector -rdynamic -Wl,-export-dynamic -Wl,-E -Wl,-Bsymbolic-functions -fPIE -pie -Wl,-z,relro -Wl,-z,now -Wl,--as-needed -o vim -lm -ltinfo -lnsl -lselinux -lacl -lattr -lgpm -ldl -L/usr/lib -llua5.2 -Wl,-E -fstack-protector-strong -L/usr/local/lib -L/usr/lib/x86_64-linux-gnu/perl/5.22/CORE -lperl -ldl -lm -lpthread -lcrypt -L/usr/lib/python2.7/config-x86_64-linux-gnu -lpython2.7 -lpthread -ldl -lutil -lm -Xlinker -export-dynamic -Wl,-O1 -Wl,-Bsymbolic-functions -L/usr/lib/x86_64-linux-gnu -ltcl8.6 -ldl -lz -lpthread -lieee -lm -lruby-2.3 -lpthread -lgmp -ldl -lcrypt -lm
zz@zzm:doc$
The next step is to use :UpdateTypesFile.
The next step is to look at how to get vim and taghighlight to use python3.6 and see if there are any problems.
ERROR: You must wait longer to change your password passwd: Authentication token manipulation error
[monitor@monitor1 etc]$ passwd
Changing password for user monitor.
Changing password for monitor
(current) UNIX password:
You must wait longer to change your password
passwd: Authentication token manipulation error
Linux Version: Red Hat EnterpriseLinux Server Release 5.7 (Tikanga)
Fix: Linux has a limit on the amount of time you can change your password again. If the number of days is 5, the user in Linux cannot change his password for 5 days. You can change this setting in the /etc/shadow file: the fourth field is the number of days it will take to change the password again.
【linux】error: stdio.h: No such file or directory
Ubuntu does not have a C and C++ compilation environment by default
By default, Ubuntu does not have C and C++ compiler environment. When newly installed Ubuntu USES GCC, it will report an error and cannot find a certain header file. When compiling a demo such as hello world, an error will be reported:
error: stdio.h: No such file or directory
Install the C and C++ compilation environment
if there is no aptitude installed, use apt-get, e.g.
udo apt-get install build-essential
Error: stray ‘- 239’in program solution
However, when using miPSEL -Linux-GCC cross-compilation, the error is reported from the first line of the code, as shown in the figure below:
Error: stray ‘239 \’ in the program
Error: stray ‘387 \’ in the program
The reason:
Placing boms in UTF-8 files is largely Microsoft’s custom (by the way, it’s also Microsoft’s custom to call a SMALL sequence UTF-16 with A BOM “Unicode” without specifying it). BOM (Byte Order Mark) is prepared for UTF-16 and UTF-32 and is used to mark byte order. Microsoft USES BOM in UTF-8 because it makes a clear distinction between encoding like UTF-8 and ASCII, but such files can cause problems in operating systems other than Windows.
No BOM is required in UTF-8, although the Unicode standard allows the use of Boms in UTF-8. So UTF-8 without BOM is the standard form.
Solutions:
Use VI to open the code and set the NoBomb item.
: set nobomb
Save and exit.
Or, add Settings to the system’s VIM configuration file and reopen ViM:
vim ~/.vimrc
Fatal IO error 11
fatal io error 11 on x server:1
Method one:
In VMware Workstation8.0, set as follows:
1. Create the virtual machine as shown in the figure below
2. Modify the virtual machine hardware compatibility 6.5-7.x,
3. At least 1G of virtual machine memory
4. The resolution of the virtual machine is at least 800*600, and I set it to 1024*768
After the above four steps, fatal IO Error 11 on X Server :1 of Cenos-6.6 installed on the virtual machine can be resolved
Method 2:
Set the memory on the virtual machine to be less than 1024M, and I generally set the memory to be 512M, so as to skip the installation of X Server related services and solve the fault.
If elif writing method of shell script
#!/bin/bash
a=100
b=150
if [ $a == $b ]
then
echo "a==b"
elif [ $a -gt $b ]
then
echo "a > b"
elif [ $a -lt $b ]
then
echo "a < b"
else
echo "a b not known"
fi
Output results:
a < b
Ubuntu 20.04 builds nginx 1.18.0 and MAC file transfer / download to server
Install Nginx, configure firewall and file structure; SFTP transfer download, SCP upload download.
// it is not clear here that it is very similar to the last one.
Nginx
Install Nginx
Apt get update
apt install nginx
;
after installation, the service will be automatically executed,
verification: systemctl status nginx
;
Configure the firewall
ufw allow 'Nginx
;
verification :ufw status
;
Successful execution interface
File structure
all Nginx configuration files are located in /etc/nginx
directory.
the main configuration file for Nginx is /etc/nginx/nginx.conf
. To make the Nginx configuration easier to maintain, it is recommended to create a separate configuration file for each domain. You can have as many server block files as you want.
Nginx server prevents files from being stored in the /etc/nginx/ locations-available
directory. Nginx will not use the configuration files found in this directory unless they are linked to the /etc/nginx/ location-enabled
directory.
to activate the server block, you need to create a symbolic link (pointer) from the configuration file site in the sites-available directory to the directory sites-enabled.
is recommended to follow standard naming conventions. For example, if your domain name is mydomain.com, then your configuration file should be named /etc/nginx/sites-available/mydomain.com.conf code>
the/etc/nginx/snippets directory contains can included in the configuration file from the server. If you use repeatable configuration segments, you can refactor these segments into fragments and include the fragment file in the server block.
Nginx log files (access.log and error.log) are located in the /var/log/ Nginx
directory. It is suggested that there are different Access, and the error is the log file of each server module.
The MAC sends files to the server
SFTP transfer download
Create a new remote connection in the shell and send it using SFTP (prompted for server password) :
Use put to send command: put local file path remote path
; The
put command cannot upload a folder directly. Can be packaged for delivery.
use the get download command get remote path
;
use bye to exit SFTP :bye
.
SCP upload and download
1, from the server to download file SCP username @ servername:/path/filename/Users/MAC/Desktop (local directory) code>
For example: SCP [email protected]:/root/zouzouzou. TXT/Users/MAC/Desktop code> is the server/root/zouzouzou. TXT/Users/MAC/downloaded to a local Desktop directory.
[email protected]: SCP - r/raid5 ZXX/my_download/zouzouzou.zip/users/zhuxiaoxia/Desktop code>
2. Upload local files to the server SCP /path/filename username@servername:/path
;
For example, SCP/Users/MAC/Desktop/zouzouzou. TXT [email protected]:/root/ code>
3. Download the whole directory scp-r username@servername:/root/ (remote directory) /Users/ MAC /Desktop (local directory)
For example : scp-r [email protected]:/root/ /Users/ MAC /Desktop/
4. Upload directory to server scp-r local_dir username@servername:remote_dir
For example: scp-r test [email protected]:/root/ upload the test directory under current directory to the server's /root/ directory
Reminder: The target server wants to enable write permission.
Differences between VI and VIM in Linux
All Linux systems will be built in vi text compiler
vim has the ability of program editing, is an enhanced version of vi, can take the initiative to distinguish the correctness of grammar with font color, convenient programming. The programming functions of code completion, compilation and error jump are particularly rich.
vi three modes
command line mode
insert mode
insert mode
bottom line mode
command line mode: when users edit files with vi, they initially enter the general mode. In this mode the user can move up and down through the cursor on the “delete” or “the whole line operations” and other operations, also can undertake “copy”, “paste”, such as operation, but cannot edit text
insert mode: text edit users to input, the user can press the ESC key to return to the command line mode
the bottom line: the cursor is located in the bottom of the screen, the user can save to file, or exit the operation, also can set the editing environment, such as looking for a string, line Numbers listed
common command line mode function keys
function keys th> | function th> tr> | |||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
I td> | switch to the insert mode, in front of the current cursor insert input text td> tr> | |||||||||||||||||||||||||||||||||||||||||||||
a td> | switch line mode, Behind the current cursor insert input text td> tr> | |||||||||||||||||||||||||||||||||||||||||||||
o td> | what line mode switch td> tr> | |||||||||||||||||||||||||||||||||||||||||||||
Ctrl + b td> | screen back to turn over a page td> tr> | |||||||||||||||||||||||||||||||||||||||||||||
Ctrl + f td> | screen forward one page td> tr> | |||||||||||||||||||||||||||||||||||||||||||||
Ctrl + u td> | screen turn back half a page td> tr> | |||||||||||||||||||||||||||||||||||||||||||||
td> 0 (zero) array td>
| cursor to the beginning of the bank td> tr>
| G td>
| cursor to the end of the file td> tr>
| nG td>
| cursor to the first n rows td> tr>
| $ td>
| moved to the end of each line cursor line td> tr>
| n td>
| cursor moves down n td> tr>
| /name td>
| after the cursor a called name string td> tr>
| ?The name td>
| before the cursor a called name string td> tr>
| x td>
| delete the location of the cursor one character td> tr>
| x td>
| delete the location of the cursor one character at a time before td> tr>
| dd td>
| delete line cursor td> tr>
| NDD td>
| lines from the cursor downward to delete n td> tr>
| yy td>
| copy line cursor td> tr>
| nyy td>
| copy from the cursor down n rows td> tr>
| p td>
| characters paste to the cursor to the buffer td> tr>
| n td>
| recovery before an action td> tr>
| : the set Nu td>
| cancel line number td> tr>
| : set nonu td>
| cancel td> tr> tbody> table> | Bottom row mode function key
|