RHEL6系统基本操作

RHEL6系统基本操作
 问题

  1. 使用GNOME桌面环境
  2. 执行基本的命令行操作:ls、uname、hostname、ifconfig、pwd、cd、ls -l、shutdown、cat /proc/cpuinfo、cat /proc/meminfo
     方案
    使用GNOME环境不是本课程的重点,大家可在课下时间简单了解即可。GNOME提供了gnome-terminal窗口程序,用来在图形桌面中执行命令行,在此终端中练习常用命令。
     步骤
    实现此案例需要按照如下步骤进行。
    步骤一:打开gnome-terminal窗口程序
    只需右击桌面(或资源管理器)空白处,选择“打开终端”,如图-45所示。
    RHEL6系统基本操作
    图-45
    步骤二:执行基本的命令行操作
    在gnome-terminal窗口程序执行命令,ls、uname、hostname、ifconfig、pwd、cd、ls –l、shutdown、cat /proc/cpuinfo、cat /proc/meminfo。
    命令操作如下所示:
    [[email protected] ~]# uname //查看系统构架
    Linux
    [[email protected] ~]# uname -r //查看内核版本
    2.6.32-431.el6.x86_64
    [[email protected] ~]# uname -a //显示主机名/内核/硬件平台等全部信息
    Linux localhost.localdomain 2.6.32-431.el6.x86_64 #1 SMP Sun Nov 10 22:19:54 EST 2013 x86_64 x86_64 x86_64 GNU/Linux
    [[email protected] ~]# cat /etc/redhat-release //查询具体小版本
    Red Hat Enterprise Linux Server release 6.7 (Santiago)
    [[email protected] ~]# hostname //查看主机名称
    localhost.localdomain
    [[email protected] ~]# hostname nsd.tarena.com //设置主机名
    [[email protected] ~]# hostname //查看主机名称
    nsd.tarena.com
    [[email protected] ~]# ifconfig eth0 //查看第一块网卡信息
    eth0 Link encap:Ethernet HWaddr 00:0C:29:C2:46:AF
    inet addr:192.168.182.230 Bcast:192.168.182.255 Mask:255.255.255.0
    inet6 addr: fe80::20c:29ff:fec2:46af/64 Scope:Link
    UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
    RX packets:21 errors:0 dropped:0 overruns:0 frame:0
    TX packets:53 errors:0 dropped:0 overruns:0 carrier:0
    collisions:0 txqueuelen:1000
    RX bytes:3152 (3.0 KiB) TX bytes:9297 (9.0 KiB)
    [[email protected] ~]# ifconfig eth0 10.0.0.10 //更改ip地址
    [[email protected] ~]# ifconfig eth0 //查看第一块网卡信息
    eth0 Link encap:Ethernet HWaddr 00:0C:29:C2:46:AF
    inet addr:10.0.0.10 Bcast:10.255.255.255 Mask:255.0.0.0
    inet6 addr: fe80::20c:29ff:fec2:46af/64 Scope:Link
    UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
    RX packets:31 errors:0 dropped:0 overruns:0 frame:0
    TX packets:61 errors:0 dropped:0 overruns:0 carrier:0
    collisions:0 txqueuelen:1000
    RX bytes:4322 (4.2 KiB) TX bytes:11051 (10.7 KiB)
    [[email protected] ~]# cat /proc/cpuinfo //查看CPU信息
    processor : 0
    vendor_id : GenuineIntel
    cpu family : 6
    model : 58
    model name : Intel® Core™ i3-3220 CPU @ 3.30GHz
    stepping : 9
    cpu MHz : 3292.549

    [[email protected] ~]# cat /proc/meminfo //查看内存信息
    MemTotal: 1023848 kB
    MemFree: 367560 kB

    [[email protected] ~]# pwd //显示当前目录
    /root
    [[email protected] ~]# cd /etc/pki/CA/private/ //打开目录
    [[email protected] private]# pwd //显示当前目录
    /etc/pki/CA/private
    [[email protected] private]# cd … //返回上一个目录
    [[email protected] CA]# pwd
    /etc/pki/CA
    [[email protected] CA]# cd …/…/ //返回上两个目录
    [[email protected] etc]# pwd //显示当前目录
    /etc
    [[email protected] etc]# ls //查看当前目录信息
    [[email protected] etc]# ls -l //查看当前目录详细信息
    [[email protected] etc]# sync //保存内存缓存信息
    [[email protected] ~]# shutdown -h +15 “The server will shutdown in 15 minutes”
    //服务器还有15分钟关闭维护
    Broadcast message from root (pts/1) (Tue Dec 10 09:42:41 2013):

The server will shutdown in 15 minutes
The system is going DOWN for system halt in 15 minutes!