Linux command logging

Source: Internet
Author: User

Port number 1. View port number
    • Use netstat -anp to see those ports being opened. The add parameter '-n ' will convert the application to port display, that is, the address of the number format, such as: nfs->2049, ftp->21, so you can open two terminals, one for each corresponding to the port number of the program
    • lsof -i:$PORTView the program that applies the port (the $PORT corresponding port number). Or you can view the file /etc/services , from which you can find the service that corresponds to the port.
2. Close the port
    • To disable the port through the Iptables tool, such as:
       sudo  iptables-a input-p tcp--dport $PORT-< Span style= "color: #000000;" >j drop  sudo  iptables-a output-p tcp--dport $PORT-j DROP 
    • or When the corresponding application is closed, the port naturally shuts down, such as: kill-9 pid (PID: Process number)
       via NETSTAT-ANP | grep  ssh   There is a display: TCP  0  127.0 . 0.1 : 2121  0.0 . 0.0 :* LISTEN 7546 /ssh   kill -9  7546  
Version number 1. Kernel version
cat /proc/uname -uname -R
2. System version
[Email protected] ~]# lsb_release-cat /etc/cat /etc/redhat-release
3. Number of system bits
 [[email protected] ~]# getconf long_bit #或者 [[email protected] ~]# getconf word_bit[[email protected]  ~]# file /bin/ls  [[email protected]  ~]# lsb_release-a 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.