sh 服务器片段

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了sh 服务器片段相关的知识,希望对你有一定的参考价值。

// to add a new JAVA environment to the server.(whether it is a test/development.)
	."nano .bash_profile"
	// add the below line inside this.
	."export SPRING_PROFILES_ACTIVE=dev" (specify your configuration name here.)

// after every configuration changeds in the OS execute the below command.
	."source filename"


 // to open ports in the cent os
	// to check the active zones.
		."firewall-cmd --get-active-zones"
	// use this below command and replace your port number with what ever port you want
		."firewall-cmd --zone=public --add-port=2888/tcp --permanent"
	//reload the firewall to load the new changes.
		."firewall-cmd --reload"
	//check the open ports in firewall
		."firewall-cmd --list-all"

// to restart any of the services
	."systemctl restart softwarename"

// Change the default 'root' password to a different password.
// can be used to change the password at any point of time by just mentioning the user at the end insterd of root.
. set/reset root password
	CMD - "passwd root"

// If needed create different users based on your requirement.
. add new user (e.g: us) 
	"adduser us"

// after the above step create a password for the above mentioned user. 
. set passwd for the new user (ex: us)
	"passwd us"

// new users has to be assigned to a group. 
. add new user to super privileges group (wheel) (ex: us)
	"gpasswd -a us wheel"
	
// "java -version" - (to get the version of the installed java.)

// restart httpd (apache)
"systemctl status httpd" - to get the satatus of the httpd. 
	"systemctl restart httpd" - to get the apache restarted.
	
	
// directory comands

// to unzip a file.
"unzip dist.zip"

// to remove the folder
"rm -rf dist"

// to remove a file.
"rm dist.zip"

//to create a zip out of a folder
"zip -r output_file.zip foldername"

"zip -r mysql.zip mysql"	

以上是关于sh 服务器片段的主要内容,如果未能解决你的问题,请参考以下文章

sh 大脚壳片段

sh psr-4片段

sh Debian linux片段

sh Docker片段

sh 杂项bash片段

sh 片段25