Linux小知识集

1、Linux系统时间设置

1、通过date命令查看目前的时间

[root@localhost ~]# date    

2013年 02年 21日 14:55:26 CST

2、查看时间帮助

[root@localhost ~]# date  --help

3、设置系统日期

[root@localhost ~]# date    -s 02/21/13

4、设置系统时间

[root@localhost ~]# date    -s  14:58:30

5、使系统时间生效

[root@localhost ~]# clock -w

 

2、Linux版本号查询

[alm@21SQ-bbkz01 csvn]$ cat /etc/issue

Red Hat Enterprise Linux Server release 5.8 (Tikanga)

Kernel \r on an \m

3、su root 与 su - root的区别

解:su - root 真正的切换为root用户


4、系统重启时,服务自动重启的方法

解:在CentOS或者RedHat其他系统下,如果是后面安装的服务,如httpd、mysqld等,安装后系统默认不会自动启动的。就算手动执行/etc/init.d/mysqld start启动了服务,只要服务器重启后,系统仍然不会自动启动服务。

这时,我们就需要在安装后做个设置,让系统自动启动这些服务,避免不必要的损失和麻烦。

a、检查服务列表是否存在此服务

#chkconfig --list httpd

b、将服务尚添加到chkconfig列表

#chkconfig --add httpd

c、将httpd设置为开机自动启动:

#chkconfig httpd on

0~6均为off,则说明httpd服务不会在系统启动的时候自动启动。

2~5都是on,就表明会自动启动


5、搭建虚拟机,设置ip后,其它内网人员无法ping通设置的ip地址(我此时连的无线)

解:1、改为内网连接 

2、重设虚拟机centos的ip地址为内网网段ip 

3、改变网络连接访问为“桥接”方式,并进行激活 

 4、重启网络service network restart  

5、ping网络测试是否可以访问


6、CentOS系统为normal用户设置sudo权限

a、检查是否已安装sudo

#rpm -qa|grep sudo

b、修改/etc/sudoers文件,添加sudo用户

#visudo -f /etc/sudoers

c、在root ALL=(ALL) ALL 之后增加

tom ALL=(ALL) ALL

Defaults:tom timestamp_timeout=-1,runaspw

//增加普通账户tom的sudo权限

//?timestamp_timeout=-1???只需验证一次密码,以后系统自动记忆

//?runaspw????需要root密码,如果不加默认是要输入普通账户的密码

d、修改普通用户的.bash_profile文件(vi /home/tom/.bash_profile),在PATH变量中增加 以下行

/sbin:/usr/sbin:/usr/local/sbin:/usr/kerberos/sbin


7、建立连接

ln -s /opt/svnedge/csvn/data data建立连接到根目录下的data下面(用root在根目录下面运行)


8、取得目前主机启动的服务

netstat -tuln

9、创建多层目录
mkdir -p parent/child1/clild2/.. (Linux)
md parent/child1/clild2/..   (Windows)


你可能感兴趣的:(Linux小知识集)