zoukankan      html  css  js  c++  java
  • Linux操作系统基础知识part5

    ifconfig 命令
    查看网络信息
    eth0 eth1
    em1 em2
    p2p2 p2p3

    systemctl status network 查看网络状态
    systemctl start network
    systemctl stop network
    systemctl restart network

    网络管理
    网络管理
    设置ip
    setup
    service network restart
    网卡配置文件
    /etc/sysconfig/network-scripts/ifcfg-eth0

    ifconfig eth0
    ifconfig eth0 10.10.10.10

    ifconfig eth0 down
    ifconfig eth0 up
    ifdown eth0
    ifup eth0

    ifdown eth0 || ifup eth0 前一个命令正确执行,后一个命令不执行
    ifdown eth0 && ifup eth0 前一个命令必须正确执行,然后执行后一个命令
    ifdown eth0 ; ifup eth0 不管前一个命令是否正确执行,后一个命令都要执行

    网卡别名
    ifconfig eth0:0 10.10.10.10
    永久保存
    cd /etc/sysconfig/network-scripts/
    cp ifcfg-eth0 ifcfg-eth0:0
    vim ifcfg-eth0:0
    DEVICE=eth0:0
    BOOTPROTO=none
    HWADDR=00:0c:29:d5:0b:2b
    ONBOOT=yes
    IPADDR=10.10.10.10
    NETMASK=255.255.255.0
    GATEWAY=10.10.10.1
    TYPE=Ethernet

    service netwrok restart

    route -n
    route add default gw 192.168.1.254
    route del default gw 192.168.1.254

    traceroute www.baidu.com

    arping 192.168.1.254

    arp

    ping

    ip addr show

    主机名
    hostname
    hostname robin.com
    /etc/sysconfig/network 主机名配置文件
    HOSTNAME=robin.com

    vim /etc/hosts
    192.168.1.254 robin.com

    开启路由转发功能
    cat /proc/sys/net/ipv4/ip_forward
    echo 1 > /proc/sys/net/ipv4/ip_forward


    查找命令
    1.which
    2.whereis
    3.grep
    4.locate(依赖updatedb)
    5.find
    find / -name initrd.img
    find / -type p -ls
    find / -links 10 -ls
    find /home -user robin -ls
    find /home -group sal -ls
    find /home -nogroup -ls
    find /home -nouser -ls
    find /home ( -nouser -a -nogroup ) -ls
    find /home ( -nouser -o -nogroup ) -ls
    find /home -nouser -exec rm -rf {} ;
    find /home -nogroup -ok rm -rf {} ;

    find /home/test/ -size 300M
    find /home/test/ -size +300M
    find /home/test/ -size -300M
    find /home/test/ -size +150M -a -size -350M
    find /home/test/ -size -150M -o -size +350M

    touch -m -d 20101010 aa.txt
    touch -m -t 201010101010.10 aa.txt
    find /home/test/ -mtime 5
    find /home/test/ -mtime +8
    find /home/test/ -mtime -8
    find /home/test/ -mtime +2 -a -mtime -10
    find /home/test/ -mtime -2 -o -mtime +10

    find /home/test -perm 500 正好匹配
    +500 任意匹配
    -500 完全匹配

    find / -type f | xargs file
    cut -d: -f 1 /etc/passwd | xargs
    cut -d: -f 1 /etc/passwd | xargs mkdir

    中天一片无情月,是我平生不悔心
  • 相关阅读:
    JSONObject简介
    android:layout_gravity 和android:gravit的区别?
    CountDownTimer,0,0
    java应用集锦9:httpclient4.2.2的几个常用方法,登录之后访问页面问题,下载文件
    HttpClient学习系列 -- 学习总结
    创建多线程的HttpClient
    HttpClient4.X 升级 入门 + http连接池使用
    Java Executors(线程池)
    [微软官方]SQLSERVER的兼容级别
    vSphere Client 连接ESXi 或者是vCenter 时虚拟机提示VMRC异常的解决办法
  • 原文地址:https://www.cnblogs.com/ArmoredTitan/p/6913082.html
Copyright © 2011-2022 走看看