Add a new user sudo adduser linuxidc sudo vim to the current directory /etc/sudoers root ALL=(ALL) linuxidc ALL=(ALL) ALL Make the same permissions change for all files in the current directory and subdirectories (i.e. change them one by one recursively) * : Wildcard, Free sync echo 3 > /proc/sys/vm/drop_caches # install SSH sudo apt-get install openssh-server # check whether ps is enabled -e | grep SSH # query whether the jar package start ps - ef | grep Java # SSH service sudo/etc/init. # d/SSH to start the SSH server configuration file is located in the/etc/SSH/sshd_config, Here you can define the SSH service port. The default port is 22. SSH service: Sudo /etc/init.d/ SSH stop sudo /etc/init.d/ SSH start # delete files rm Java # delete files rm -r Java # install LRZSZ # backup current which is the default official source list sudo cp/etc/apt/sources list/etc/apt/sources list. The backup sudo gedit/etc/apt/sources list # installation gedit editor Apt to get the install gedit # view port netstat TLNP netstat TLNP | grep 80 # view takes up port of the specific procedures lsof - I: 3306 # 27833 kill kill kill process pid 1. Poweroff immediately. 3. Shutdown -h now If the shutdown command is used to set the shutdown, You can run shutdown -c to cancel the command. 1. Reboot 2. Shutdown -r now Restart the system immediately (for root user) 3 Restart at 20:35 (used by root user) Tar -zxvf JDK -xxxxx -c /usr/soft/ #sudo gedit ~/. Bashrc sudo vim Source /etc/profile export JAVA_HOME=/usr/lib/jdk1.8.0_45 export CLASSPATH=.:$JAVA_HOME/lib:$JAVA_HOME/jre/lib:$CLASSPATH export PATH=$JAVA_HOME/bin:$JAVA_HOME/jre/bin:$PATH #set oracle JDK environment export JAVA_HOME=/usr/lib/jvm/jdk1.7.0_60 ## export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib export PATH=${JAVA_HOME}/bin:$PATH #MAVEN_HOME export MAVEN_HOME=/workshop/maven/apache-maven-3.3.9 export MAVEN_OPTS=" -xMS256m -XMx512m "export PATH=${MAVEN_HOME}/bin:$PATH GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'lxh' WITH GRANT OPTION; LXH remote access to all database privileges flush PRIVILEGES # redis installation sudo apt - get the install redis - # nginx server install sudo apt - get the install nginx netstat TLNP | grep nginx check the running status of sudo /etc/init.d/nginx Usage: The/etc/init. D/nginx {start | stop | status | restart | condrestart | try to restart | reload | force - reload | configtest} third, use /hello.sh: vi /root/.bashrc alias CBD ='/home/admin/sh/cbd.sh start'Copy the code
Open the terminal: CTRL+ALT+T ls Lists the files in the current directory (excluding hidden files) ls -a Lists the files in the current directory (including hidden files) ls -l Lists the details of files in the current directory CD.. CD - Back to the previous directory CD ~ or CD Back to the host directory of the current user mkdir Directory name Create a directory rmdir Empty directory name Delete an empty directory rm file name Delete a file or multiple files rm -rf Non-empty directory name Delete all mv paths/files/paths/files in a non-empty directory Move files in relative paths to absolute paths. Mv file name New name Rename the file in the current directory. Find path -name String Search for files and directories that match strings in the path -a Check the kernel version sudo fdisk -l Check the disk information df -h Check the free disk space free -m Check the current memory usage ps -a Check the current processes kill the process id (the number in the first column of ps -a) or killall Process name (kill a process) kill -9 process id forcibly kill a process reboot Init 6 restart the LINUX OS Halt Init 0 Shutdown -h now Shutdown the LINUX OS 3. Package or decompress tar -c to create a package -x -z indicates the compressed package tar -cvf benet.tar /home/benet Package the /home/benet directory tar -zcvf benet.tar.gz/MNT Package the directory and compress tar -zxvf Gz Decompress files tar -zxvf benet.tar.bz2 Decompress files tar -zxvf archiven1.tar. gz -c/TMP /extract_here/ 5 Apt-cache search package Apt-cache show package Sudo apt-get install package 安装 安装 sudo apt-get install package 安装 sudo apt-get -f install Sudo apt-get remove package sudo apt-get remove package sudo apt-get remove package Sudo apt-get upgrade sudo apt-get upgrade sudo apt-get upgrade sudo apt-get upgrade sudo apt-get upgrade sudo apt-get Sudo apt-get sudo apt-get sudo apt-get sudo apt-get sudo apt-get sudo apt-get sudo apt-get sudo apt-get sudo apt-get Sudo apt-get clean && sudo apt-get autoClean Sudo apt-get autoClean sudo apt-get autoclean Sudo apt-get clean Add a service #sudo update-rc.d Remove Temporarily restart a service #/etc/init.d/ service name restart Temporarily stop a service #/etc/init.d/ service name stop Do not use any of the alternatives at all. Do not use any of the alternatives at all. Do not use any of the alternatives at all #sudo apt-get install convmv convmv -r -f cp936 -t UTF8 -notest #find src-type d -exec mkdir -p UTF8 /{} \; find src -type f -exec iconv -f GBK -t UTF-8 {} -o utf8/{} \; Mv utf8/* SRC rm -fr utf8 convert file contents from GBK to utf8 #iconv -f GBK -t utf8 $I > newfile Unzip zip xxx.tar.gz #tar -zxvf xxx.tar.gz Gz # tar-zcvf XXX.tar. gz aaa BBB zip aaa BBB directory xxx.tar.bz2 #tar #sudo apt-get install RAR field #sudo ln -f /usr/bin/r/usr/bin/unrar 2) Rar program details the running information of the program #strace -f -f -o outfile Date and time set date #date -s mm/ DD /yy Set time #date -s HH: mm Writes time to CMOS #hwclock -systoHC reads CMOS time #hwclock -hctosys synchronizes time from server #sudo ntpDate time.nist. Gov #sudo ntpDate console Switch between different consoles Ctrl + ALT + ← Ctrl + ALT + → Switch to the specified console Ctrl + ALT + Fn(n:1~7)Copy the code
Run the scriptgreen='\e[0;32M '# greenNC='\e[0M prime # has no colorCSMART_WEBSERVER_PID=$(cat /home/admin/sh/csmart-webserver.pid)
if [ -n "$CSMART_WEBSERVER_PID" ]
then
echo 'kill '$CSMART_WEBSERVER_PID
kill $CSMART_WEBSERVER_PID
fi
echo 'start update csmart-weberser project'
cd /home/admin/csmart-webserver
git pull origin master
echo 'start build csmart-webserver project'
cd /home/admin/csmart-webserver
mvn install
cd /home/admin/csmart-webserver/target
echo 'start deploy csmart-webserver project'
nohup java -Xdebug -Xrunjdwp:server=y,transport=dt_socket,address=8004,suspend=n -jar /home/admin/csmart-webserver/target/csmart-0.0.1-SNAPSHOT.jar --spring.profiles.active=online > /home/admin/logs/csmart-start.log 2> &1 &
echo $! > /home/admin/sh/csmart-webserver.pid
START_TIME=`date +%s`
while [[ -z `netstat -ln|grep 9004` ]]
do
TIME_TOTAL=$[`date +%s`-START_TIME]
printf "\r" $b $i
echo -n "[csmart-webserver] the server is starting :$TIME_TOTAL S "
sleep 1
done
echo -e "\n${green}***********************************************************************${NC}"
echo -e "\n${green}********************************finish*********************************${NC}"
echo -e "\n${green}[csmart-webserver] the tuew-webserver start finihed${NC}"
echo -e "\n${green}*********************************end***********************************${NC}"
Copy the code