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 -sMM/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 <内核完整名称>

因为在路上你就已经收获了自由自在的好心情。

linux使用心得(持续更新)

相关文章:

你感兴趣的文章:

标签云: