linux (centOS7) Basic Operation (vii) Other

Transfer files between local and linux server

Local downloaded file, if you want to execute on a remote linux server, file transfer needs. If the local system using windows, graphical interface software is to XFTP aid. If the local use macOS system, you need to use scp command, the focus here is described for scp command between macOS and linux file transfer.

1. From the local to upload files to a remote server linux

scp [-r] source username@ip:path

Which, source expressed the need to upload the files in the local path name, username represents the user login name, ip indicates that the server's ip, path represents the path to the location uploaded to the server. If uploading is a directory, you need to add -r.

2. Download the file from the server to the local linux

scp [-r] username@ip:source path

Compared to upload, just reverse the unknown parameters.

 

Command with respect to time

1. Display time

date

It displays the current time, the default format, such as " June 16, 2019 Sunday 10:53:54 CST";

date '+%Y-%m-%d'

Format with the specified date, for example "2019-06-16";

date '+%Y-%m-%d %H:%S:%M'

When the date is displayed with the specified format every minute, for example, "2019-06-16 10:37:16."

2. Display calendar

cal [year]

Which, year represents the year to be displayed, if not only display the current month.

 

Call history

1. Call through the command history

history [number]

Where number is a number that represents how many view the most recent, if not all calls over command will be displayed.

!number

Use this command to execute the command number number.

 

Environment Variables

For example, a window system installed in the Java Runtime Environment, we need to modify environment variables JDK, Tomcat and other software, to execute javac, java, startup.bat commands in any directory. Also, install the software in linux server, also need to modify environment variables. There are two ways, one is the temporary modification takes effect only for the current shell, and the other is a permanent modification.

1. export command, temporarily modify environment variables

export /usr/local/jdk1.8.0_211/bin:$PATH

export /usr/local/apache-tomcat-8.5.42/bin:$PATH

2. / etc / profile file, modify environment variables permanently

Behind the / etc / profile file and add:

JAVA_HOME=/usr/local/jdk1.8.0_211

export PATH=${JAVA_HOME}/bin:$PATH

TOMCAT_HOME=/usr/local/apache-tomcat-8.5.42

export PATH=${TOMCAT_HOME}/bin:$PATH

Then, restart the server, or call the source / etc / profile for the changes to take effect.

 

 

Guess you like

Origin www.cnblogs.com/dubhlinn/p/11117049.html