Network and process management commands

Network and process management commands

network management commands

  • ping IP_ADDR to test whether the network is connected
    • -s N send N bytes
    • -i N pings every N seconds
    • -c N ping times is N times
  • traceroute IP_ADDR/HOSTNAME show route trace information
  • route shows the routing table
    • -n numeric form
    • Add and delete routing table entries
      • route add -net IPADDR netmask NETMASK gw GATEWAY
      • route del -net IPADDR netmask NETMASK
  • ifconfig [NIC_NAME] [IP_ADDR[/]MASK] [up/down] Display/configure NIC information
    • -a Display all network card information
    • -s summary information [similar to netstat -i] netmask NETMASK
  • netstat shows network status
    • -a show all
    • -r show routing table
    • -n numeric mode
    • -l show listening status connections
    • -t show TCP connections
    • -u show UDP connections
    • -p show PID and process name
    • -c Continuously list network status

Process management commands

Process priority (nice) Ordinary users can only increase the nice value. The smaller the number, the higher the priority. The nice value range is -20 ~ 19 [100-139] (0-99 is the kernel priority) Ctrl+z Command switching running in the foreground Go to background and pause CMD &Run in background at startup

  • ps display process information       BSD form
    • a shell related process
    • u User and other information
    • x shell independent process SYSV form
    • -e show all processes
    • -f show more fields
    • -F show more more fields
    • -l display in long format
    • -o ATTR1,ATTR2 display the specified fields
  • pstree shows the process tree
    • -a display command with full parameters
    • -c cancel merging of sibling processes with the same name
    • -p show process PID
    • -u show process UID
    • -h highlight the parent process of the current process
  • top monitoring process information
    • -n N display N times
    • -b batch mode
    • -d D refresh duration is D seconds Interactive subcommand
    • M Sort by memory usage
    • P sorted by CPU usage
    • T Sort by time of use
    • l Show/hide load average and startup time information (uptime command)
    • t Show/hide process and CPU information
    • m show/hide memory information
    • c whether to display the full command line
    • k N terminates the process with PID number N
    • q quit command
  • kill PID kills the process
    • -l Display signal list does not require PID parameters to send SIGTERM signal by default -N send N corresponding signal
  • killall PROCESS_NAME kills all processes named PROCESS_NAME
  • renice Nice PID Modify the nice value of the started process
  • nice -n NICE COMMAND specifies the nice value of the process at startup
  • jobs view background jobs, + is the default job, - is the second default job. Terminate the job: kill %JOB_ID
  • bg [%JOB_ID] stop background job
  • fg [%JOB_ID] called back to the foreground to run

Network file configuration (network card eth0)

The command can only take effect temporarily, and the file configuration can take effect permanently.

Redhat series (CentOS6.5)

global network configuration file /etc/sysconfig/network settings enable network and hostname linux config

NETWORK=yes
HOSTNAME=myhost

Network card configuration file (eth0) /etc/sysconfig/network-scripts/ifcfg-eth0 static IP configuration linux config

DEVICE=eth0
IPADDR=192.168.233.1
NETMASK=255.255.255.0 
NETWORK=192.168.233.254
ONBOOT=yes
TYPE=Ethernet
BOOTPROTO=static

DHCP configuration linux config

DEVICE=eth0
ONBOOT=yes
TYPE=Ethernet
BOOTPROTO=dhcp

Restart the network service to take effect service network restart

Debian series (Ubuntu14.04)

Configuration file /etc/network/interfaces static IP configuration linux config

auto eth0
iface eth0 inet static
address 192.168.233.1
netmask 255.255.255.0
gateway 192.168.233.254

DHCP configuration linux config

auto eth0
iface eth0 inet dhcp

Restart the network service to take effect sudo /etc/init.d/networking restart

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325456834&siteId=291194637