zoukankan      html  css  js  c++  java
  • linux操作系统基础篇(五)

    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

  • 相关阅读:
    Code Forces 650 C Table Compression(并查集)
    Code Forces 645B Mischievous Mess Makers
    POJ 3735 Training little cats(矩阵快速幂)
    POJ 3233 Matrix Power Series(矩阵快速幂)
    PAT 1026 Table Tennis (30)
    ZOJ 3609 Modular Inverse
    Java实现 LeetCode 746 使用最小花费爬楼梯(递推)
    Java实现 LeetCode 745 前缀和后缀搜索(使用Hash代替字典树)
    Java实现 LeetCode 745 前缀和后缀搜索(使用Hash代替字典树)
    Java实现 LeetCode 745 前缀和后缀搜索(使用Hash代替字典树)
  • 原文地址:https://www.cnblogs.com/bsxq/p/6927043.html
Copyright © 2011-2022 走看看