zoukankan      html  css  js  c++  java
  • Linux

    总结
    1.权限管理
    1)用户权限管理
    chmod:用来改变许可权限。读取、写入、执行是许可权限中的三个重要设置
    r-文件可以被读取
    w-文件可以被写入
    x-文件可以被执行
    chown:设置用户属组
    [root@localhost ~]# chown asd:liu asd
    [root@localhost ~]# ll
    总用量 4
    -rw-------. 1 root root 929 2月 9 16:52 anaconda-ks.cfg
    -rw-r--r--. 1 asd liu 0 2月 9 23:37 asd
    [root@localhost ~]# chown asd:ting asd
    [root@localhost ~]# ll
    总用量 4
    -rw-------. 1 root root 929 2月 9 16:52 anaconda-ks.cfg
    -rw-r--r--. 1 asd ting 0 2月 9 23:37 asd
    2)文件权限
    chmond: -R 递归 将之下的权限全部改变
    [root@localhost ~]# chmod -R 777 test
    [root@localhost ~]# ll test
    总用量 0
    -rwxrwxrwx. 1 asd ting 0 2月 9 23:37 qwe
    3)防火墙:iptable
    iptables -A //新增一条规则
    iptables -I INPUT 1 //在INPUT链第一处插入一条规则
    iptables -i //数据包进入的接口
    iptables -o //数据包传出的接口
    iptables -p //数据包使用的协议 常用的有 tcp udp icmp all
    iptables -s //来源ip/网段
    iptables -d //目标ip/网段
    iptables -j //后接操作 DROP ACCEPT LOG
    iptables -P //改变链的处理方式
    iptables -F //清除所有规则
    iptables -D 链 第几个 //清除指定规则
    iptables --sport //限制来源端口范围
    iptables --dport //限制目标端口范围
    iptables -A INPUT -p icmp --icmp-type 8 -j DROP //禁ping
    iptables-save > filename //保存配置
    iptables-restore < filename //导入配置
    iptables -A INPUT -m state --state 状态
    4) selinux 清除规则
    [root@localhost ~]# vi /etc/selinux/
    修改其中的配置文件
    # This file controls the state of SELinux on the system.
    # SELINUX= can take one of these three values:
    # enforcing - SELinux security policy is enforced.
    # permissive - SELinux prints warnings instead of enforcing.
    # disabled - No SELinux policy is loaded.
    SELINUX=disabled
    # SELINUXTYPE= can take one of three two values:
    # targeted - Targeted processes are protected,
    # minimum - Modification of targeted policy. Only selected processes are protected.
    # mls - Multi Level Security protection.
    SELINUXTYPE=targeted
    5)服务权限----所有服务都是一普通用户启动的
    2 网络管理
    1)IP地址管理
    ifconfig:查看Linux系统IP地址
    ifconfig-a
    即时生效:(centenos 6版本)ifconfig eth0 x.x.x.x netmask x.x.x.x //添加IP地址
    启动生效:(手动配置IP地址)[root@localhost ~]# vi /etc/sysconfig/network-scripts/ifcfg-eno16777728
    IPADDR=x.x.x.x //添加IP地址
    NETMASK=x.x.x.x.x //掩码
    GATEWAY=x.x.x.x //添加网关
    (自动获取IP地址)TYPE=Ethernet
    BOOTPROTO=dhcp
    DEFROUTE=yes
    PEERDNS=yes
    PEERROUTES=yes
    IPV4_FAILURE_FATAL=no
    IPV6INIT=yes
    IPV6_AUTOCONF=yes
    IPV6_DEFROUTE=yes
    IPV6_PEERDNS=yes
    IPV6_PEERROUTES=yes
    IPV6_FAILURE_FATAL=no
    NAME=eno16777728
    UUID=dc09aba0-8ebf-478c-900f-4c703c4b964a
    DEVICE=eno16777728
    ONBOOT=yes
    增删改查命令
    3)DNS 查看 验证域名是否解析成功
    4)网卡管理
    网卡是Linux服务器中最重要的网络设备
    ifconfig:ifconfig 主要是可以手动启动、观察与修改网络接口的相关参数,
    可以修改的参数很多,包括 IP 参数以及 MTU 等都可以修改
    ifup:ifup eth0,它会找出ifcfg-eth0这个文件的内容
    ifdown :需要指定网卡
    3 本地资源管理命令
    内存:free
    [root@localhost ~]# free
    total used free shared buff/cache available
    Mem: 1001332 131036 562032 6728 308264 700336
    Swap: 2097148 0 2097148

    硬盘:检测硬盘能否被识别 fdisk -l
    [root@localhost ~]# fdisk -l

    磁盘 /dev/sda:21.5 GB, 21474836480 字节,41943040 个扇区
    Units = 扇区 of 1 * 512 = 512 bytes
    扇区大小(逻辑/物理):512 字节 / 512 字节
    I/O 大小(最小/最佳):512 字节 / 512 字节
    磁盘标签类型:dos
    磁盘标识符:0x000b8646

    设备 Boot Start End Blocks Id System
    /dev/sda1 * 2048 1026047 512000 83 Linux
    /dev/sda2 1026048 41943039 20458496 8e Linux LVM

    磁盘 /dev/mapper/centos-root:18.8 GB, 18756927488 字节,36634624 个扇区
    Units = 扇区 of 1 * 512 = 512 bytes
    扇区大小(逻辑/物理):512 字节 / 512 字节
    I/O 大小(最小/最佳):512 字节 / 512 字节


    磁盘 /dev/mapper/centos-swap:2147 MB, 2147483648 字节,4194304 个扇区
    Units = 扇区 of 1 * 512 = 512 bytes
    扇区大小(逻辑/物理):512 字节 / 512 字节
    I/O 大小(最小/最佳):512 字节 / 512 字节
    挂载硬盘
    1.在本地硬盘中临时创建一个目录 mkdir /opt/data/tmp1
    [root@localhost ~]# mkdir -p /opt/data/tmp1
    [root@localhost ~]# ls
    anaconda-ks.cfg test
    [root@localhost ~]# ls /opt/data/tmp1/
    [root@localhost ~]# ls /opt/data
    tmp1
    2.挂载第二块硬盘中的一个分区 /dev/sdb1到tmp1

    3.查看是否被挂载
    df -h
    cpu
    物理cpu 实际Server中插槽上的CPU个数
    物理cpu数量,可以数不重复的 physical id 有几个
    逻辑cpu
    查看cpu信息

    查看物理cpu的个数
    [root@localhost ~]# cat /proc/cpuinfo |grep "physical id"|sort |uniq|wc -l
    1
    查看逻辑cpu的个数
    [root@localhost ~]# cat /proc/cpuinfo |grep "processor"|wc -l
    1
    查看cpu是几核
    [root@localhost ~]# cat /proc/cpuinfo |grep "cores"|uniq
    cpu cores : 1

    4.进程
    CPU使用率、内存占用率、磁盘占用率、网络IO
    1、cpu占用率 top

  • 相关阅读:
    Unix环境编程之文件IO
    navicat 导出查询结果
    Java 原子类 java.util.concurrent.atomic
    AtomicBoolean介绍
    ExecutorService常用方法和newFixedThreadPool创建固定大小的线程池
    ExecutorService与Executors例子的简单剖析
    tomcat6版本虚拟目录详细配置
    生产者与消费者模型案例
    如何设计一个LRU Cache
    在MVC模式下通过Jqgrid表格操作MongoDB数据
  • 原文地址:https://www.cnblogs.com/liuyiting/p/6384001.html
Copyright © 2011-2022 走看看