Personal summary of some commonly used Linux commands
Sort out some Linux commands commonly used in work
Linux shutdown
shutdown -h now
restart the Linux server
shutdown -r now
output information (such as display java_home)
echo $JAVA_HOME
display java process details
ps aux|grep java
weblogic background start service, and save log information Go to nohup.out in the same directory
nohup ./startWebLogic.sh &
print file information in real time (usually used to view log information)
tail -f nohup.out
uses zip compression to compress all files in the current directory
zip -r . /a.zip ./*View
port information
netstat -lnp | grep 4999
zip compress the specified directory file
zip -r filename.zip file1 file2 file3 /usr/work/school
Unzip the zip file to the specified directory
unzip -n wls1036_dev.zip -d /opt/program_file/wls1036
Compress the specified directory file in tar format
tar -zcvf 20150908_com_bf01.tar.gz com
tar file decompression
tar -xzvf fileName.tar.gz
delete all files in the folder and subdirectories
rm -rf /var/log/httpd/access
decompress the rar compressed file to the specified directory (requires to install rar for linux first)
unrar e catalina.rar / usr/work/zip/102/rartest
kill the process with the specified pid
kill -9 10444
check the firewall status
/etc/init.d/iptables status
close the firewall
/etc/init.d/iptables stop
Linux server A copy server B File
scp root@[B's ip address or host name]: [file path stored on B] / file [file path stored on A]
scp [email protected]:/home/oracle/test.sql /home/oracle
With the specified port
scp -P 8889 [email protected]:/workspace/ZSB_NEW_domain/zsbCode_20160225_bf01.tar.gz /workspace/zsb_domain
Linux server A copies the folder on server B
scp -r root@[B's ip address or hostname ]: [file path stored on B] [file path stored on A]
scp -r [email protected]:/test /test
Install rpm files (such as jdk)
rpm -ivh linuxqq-v1.0.2-beta1.i386.rpm
Modify file read permissions
chown -R asns.asns SQBService
file vi operation
:w save file without exiting vi
:w file additionally save changes to file without exiting vi
:w! force save without exiting vi
:wq save file and exit vi
:wq! force save file and exit vi
:q Do not save the file, quit vi
:q! Do not save the file, force quit vi
:e! Abandon all modifications, start from the last save file and edit
i Unlock and enter
curl to simulate Http's get or post request under Linux
```
First, get Request
curl "http://www.baidu.com" If the URL here points to a file or a picture, it can be downloaded directly to the local
curl -i "http://www.baidu.com" Display all information
curl -l "http://www.baidu.com" only display header information
curl -v "http://www.baidu.com" shows the whole process of get request analysis
wget "http://www.baidu.com" can also be
```
```
Second, post request
curl -d "param1= value1¶m2=value2" "http://www.baidu.com"
```
file authorization
chmod 777 spaceplus_deploy.sh
remote copy file scp
scp [email protected]:/data/home/nickzhang/spaceplus-boss-prod.war /data/webapp
to view all process information
netstat -atlnp
to check whether the ssh service is installed
rpm -qa |grep ssh
If the SSH package is not installed, you can install it through yum or rpm installation package
yum install ssh
to start the ssh service
service sshd start
/etc /init.d/sshd start
configuration\View SSHD port
View or edit the SSH service configuration file, such as vi /etc/ssh/sshd.config
If you want to modify the port, you can change the default port 22 behind the port to another port (note that the # sign in front should be removed).
Remote connection to SSH4
If you need to connect to SSH remotely, you need to open port 22 on the firewall.
.Turn off the firewall, or set an exception for port 22
Guess you like
Origin http://43.154.161.224:23101/article/api/json?id=326313359&siteId=291194637
Recommended
Ranking