Linux common command operations

[1] Restart the operating system immediately: shutdown -r now; 
[2] Enter the file to edit: vi; After editing, save the file and exit: :wq;
[3] View the IP address: ifconfig -a;
[4] Modify the local IP address: required by vi /etc/sysconfig/network-scripts/ifcfg-eth0; it will take effect after restart and will take effect permanently.
Example: Change the fixed IP from the original DHCP
DEVICE=eth0
HWADDR=00:0C:29:F7:EF:BF
ONBOOT=yes
TYPE=Ethernet
NETMASK=255.255.255.0
IPADDR=***.**.*.**
GATEWAY =***.**.*.**


[5] Test the connectivity of the network: ping -c 4 ***.**.*.**; (automatically end after ping 4 times);
[6] View Firewall status: chkconfig iptables --list Turn on the firewall: chkconfig iptables on; turn off the firewall: chkconfig iptables off;
[7] Enable the SSH service: service sshd start; service sshd restart;
[8] Extract the tar package to the specified directory: tar -xvf **.tar -C /opt/software;
[9] Command to modify the Hosts file: cd /etc/hosts; vi edit; :wq save and exit. :q! Force quit without saving.
[10] Temporarily modify the language environment of the LINUX system: LANG=language name; for example: LANG=Zn_CN.UTF-8 LANG=en_US.UTF-8
[11] Check the usage of hard disk, memory and CPU command:
    df -h check Hard disk situation;
    free -m outputs the used and unused memory in units of megabytes, etc.
    cat /proc/cpuinfo outputs the detailed information of each processor.
[12] LINUX queries various hardware resources of the system:
    cpu: lscpu command;     memory
    : free -m;
    disk: lsblk command
    ;
;

Guess you like

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