Remote Login and Remote Copy

--------------------------------------------------------------------------------------
Modify ip address
 sudo ifconfig ens33 192.168.1.108
--------------------------------------------------------------------------------------
Figure ssh installed in Ubuntu 
 A. Install ssh server sudo apt-get install openssh-server
 B. ssh remote login user name @IP 
 
 ssh access, such as errors. You can see whether the file ~ / .ssh / known_ssh try to delete the file resolved.
--------------------------------------------------------------------------------------
4> remote file copy scp -r
 scp -r target user name @ IP address of the target host: the absolute path / destination file / save to the machine absolute / relative path
 
 You can copy a single file without -r parameter, a copy of the directory needed to be added.
 Copy local files to the remote:
   scp username @ filename target target IP: target file
   scp file name RemoteHostIp: RemoteFolder
   scp file name RemoteHostIp: RemoteFile
 Local directory to the remote:
   scp -r FolderName RemoteUserName@RemoteHostIp:RemoteFolder
   scp -r FolderName RemoteHostIp:RemoteFolder
 Copy remote files to your local:
   scp RemoteUserName@RemoteHostIp:RemoteFile FileName
   scp RemoteHostIp:RemoteFolder FileName
   scp RemoteHostIp:RemoteFile FileName
 Remote directory to the local:
   scp -r RemoteUserName@RemoteHostIp:RemoteFolder FolderName
   scp -r RemoteHostIp:RemoteFolder FolderName
--------------------------------------------------------------------------------------
Command mode:
 M: Move the cursor to the middle line 
 L: Move the cursor to the screen the last line of the line 
 G: to a specific line, the line number -G
 gg: Move the cursor at the beginning of the file 
 G: Move the cursor to the end of file
 
 Delete command:
  x: After you remove the cursor one character, the equivalent of Del 
  X: delete a character before the cursor, the equivalent of Backspace
  dd: Delete cursor line, the number of rows n dd delete the specified 
  D: Delete the cursor after the Bank all content, including character under the cursor 
  d0: Delete all the contents of the Bank before the cursor does not contain the character under the cursor
  dw: Delete the cursor starting position of a word that contains the character under the cursor
 
 Undo command:
  u: step by step withdrawal 
  Ctr-r: Anti revocation
 
 Repeat the command: 
  : Repeat the command once operated
 
 Mobile line of text:
  >>: a line of text to the right 
  <<: a line of text to the left
 
 copy and paste:
  yy: Copy the current line, n yy Copy n lines 
  p: down to open up a new line at the cursor location, paste
 
 Visual mode:
  v: move by character, select the text 
  V: line by moving the visual mode may select the text fit d, y, >>, << achieved delete text block, copy, move around
 
 Replace operation:
  r: Replace the current character 
  R: replacement character row after the current cursor
 
 Find command:
  : / Find content
  n: Next
  One of: N
 
 Replace command: abc replace all the 123 s represents g represents a global replacement
  Line mode, all of the current file abc replaced by 123
  :%s/abc/123/g
 
  Line mode, the abc between the first row to the 10th row 123 replaced
  :1, 10s/abc/123/g
--------------------------------------------------------------------------------------
Ens33 modify the ip sudo ifconfig ens33 192.168.1.108  
--------------------------------------------------------------------------------------
3.3 How to view the port number?
 -an view the port number used by the program using netstat
 lsof -i [tcp / udp]: 2425 View application corresponding to the port number
 Tip: If you can not find the port number of the application with administrator privileges plus sudo
 
--------------------------------------------------------------------------------------
2. Create a socket
 import socket
 socket.socket(AddressFamily, Type)
 
 Socket.socket function to create a socket, which takes two parameters:
  Address Family: IP address type; 
   Represents ipv4 type AF_INET, AF_INET6 represents ipv6 type; 
  Type: Socket type SOCK_STREAM (stream sockets, primarily for the TCP protocol)
    SOCK_DGRAM (datagram socket, primarily for UDP protocol)
 
 Create a udp socket (udp socket)
  import socket
  s = socket.socket (socket.AF_INET, socket.SOCK_DGRAM)
  # ... here it is using the socket functions (omitted) ...
  s.close()
--------------------------------------------------------------------------------------

Guess you like

Origin www.cnblogs.com/lab-zj/p/12166212.html