• linux使用心得(持续更新)


    ! 查看发行版本信息
    lsb_release -a
    uname -a
     
    以下方法只适合redhat和centos
    cat /etc/redhat-release
    rpm -q redhat-release
    rpm -q centos-release
     
    ! 关闭SHELL铃声
    vi /etc/inputrc
    将set bell-style none的注释取消
     
    !日期时间修改
    修改日期
    date -s MM/dd/YYYY
    修改时间
    date -s HH:mm:ss
     
    ! 日期时间格式化输出
    date +[格式化输出符]
    例如:
    date +%H:%M:%S
    17:18:24

    !同步系统时间
    ntpdate cn.pool.ntp.org;hwclock --systohc
     
    ! smbmount
    使用 mount替代,格式为cifs
    mount -t cifs -o username=xxx.password=xxx //hostname/dir /mnt/dir
    也可以建立别名
    alias smbmount='mount -t cifs'
     
    ! 终端中文设置
    yum -y groupinstall chinese-support
     
    vi /etc/sysconfig/i18n
    LANG="zh_CN.UTF-8"
    LC_MESSAGES="en_US.UTF-8"
    SUPPORTED="zh_CN.GB18030:zh_CN:zh:en_US.UTF-8:en_US:en"
    SYSFONT="latarcyrheb-sun16"
    再在PUTTY中将窗口-转换-假定接收数据的字符集设为UTF-8
     
    !设置DNS的IP
    /etc/resolv.conf
    nameserver xxx.xxx.xxx.xxx
     
    !设置网络主机名,以及是否允许使用网络
    /etc/sysconfig/network
    NETWORKING=yes
    HOSTNAME=xxx
     
    !设置具体网卡
    /etc/sysconfig/network-scripts/ifcfg-eth<0起始的数字>
    DEVICE=eth0
    BOOTPROTO=static|dhcp
    BROADCAST=
    IPADDR=
    NETMASK=
    GATEWAY=
    HWADDR=
    ONBOOT=yes
    MTU=1500
    TYPE=Ethernet
     
    !记录主机名与IP对应关系
    /etc/hosts
     
    ! 软raid5默认需要spare盘,用--force 参数可以屏蔽掉这个功能
    When creating a RAID5 array, mdadm will automatically create a degraded
       array   with   an   extra spare drive.   This is because building the spare
       into a degraded array is in general faster than resyncing the parity on
       a   non-degraded, but not clean, array.   This feature can be over-ridden
       with the --force option.
     
    !/etc/passwd字段定义
    LoginName:Password:Uid:Gid:UserInfo:Home:Shell
     
    !/etc/shadow字段定义
    LoginName:Passwd:LastChg:Min:Max:Warn:Inactive:Expire:Flag
     
    !/etc/group字段定义
    GroupName:Password:Gid:UserList(split by ',')
     
    !/etc/gshadow字段定义
    GroupName:Password:UserList(split by ',')
     
    !强制踢掉在线用户
    通过用户名踢
    pkill -u <name>
     
    通过TTY踢
    pkill -kill -t <tty name>
     
    !egrep不允许使用{}
     
    !declare命令将变量转成环境变量,供子进程调用。进程中的环境变量修改,只影响自身与子进程。
     
    !SELINUX开启时ZendGuardLoader能在PHP命令行环境加载,但无法在APACHE中加载的解决办法
    execstack --clear-execstack /usr/lib64/php/modules/ZendGuardLoader.so
     
    !复制虚拟机启动后网卡报“Device eth0 does not seem to be present,delaying initialization”
    编辑 /etc/sysconfig/network-scripts/ifcfg-eth0,将其中的MAC地址改成新虚拟机网卡的MAC地址。
    rm -f /etc/udev/rules.d/70-persistent-net.rules
    重启系统。
     
    ! 脱离终端后台运行shell
    nohup ./test.sh &
     
    !ubuntu删除多余的旧内核
    查找已经安装的内核
    dpkg --get-selections |grep linux-image
     
    根据情况删除旧内核
    sudo apt-get remove <内核完整名称>
     
    ! 获取路径里文件名与目录名的方法
    basename <路径>     #获取路径里的文件名
    dirname <路径>     #获取路径里的目录名,不包含最后的/
     
    !ubuntu处理DOS回车
    sudo apt-get install tofrodos
    fromdos <待转换为UNIX回车的文件>
    todos <待转换为DOS回车的文件>
     
    ! ubuntu安装HG
    sudo add-apt-repository ppa:tortoisehg-ppa/releases
    sudo add-apt-repository ppa:mercurial-ppa/releases
    sudo apt-get update
    sudo apt-get install mercurial python-nautilus tortoisehg
     
  • 相关阅读:
    创建内核对象的专有命名空间
    内核对象句柄表
    Windows小知识(二)
    内核对象与用户对象/GDI对象
    Windows小知识(一)
    Windows中查看错误
    handle(句柄)
    VC中调用其它程序
    消息映射的转变
    实验6.配置链路聚合
  • 原文地址:https://www.cnblogs.com/lykyl/p/3274401.html
Copyright © 2020-2023  润新知