红联Linux门户
Linux帮助
当前位置: 红联Linux门户 > Ubuntu

如何查看Linux系统是否为64位系统(转)

发布时间:2012-02-22 10:09:12来源:红联作者:xiaomage119
网上搜了下,说可以直接使用 file /sbin/init 查看当前Linux系统是否为64位系统。

我在电脑上看到的结果:
/sbin/init: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.8, stripped

ELF 64-bit LSB executable 应该就是表示该文件时在64位的系统上的可执行文件。

其实,只要用 file 命令来查看任何一个在电脑上的可执行文件(如用gcc编译生成的可执行文件)都可以查看到相似的结果。

顺便查了下 /sbin/init 文件的作用:

The /sbin/init program (also called init) coordinates the rest of the boot process and configures the environment for the user.

When the init command starts, it becomes the parent or grandparent of all of the processes that start up automatically on the system. First, it runs the /etc/rc.d/rc.sysinit script, which sets the environment path, starts swap, checks the file systems, and executes all other steps required for system initialization. For example, most systems use a clock, so rc.sysinit reads the /etc/sysconfig/clock configuration file to initialize the hardware clock. Another example is if there are special serial port processes which must be initialized, rc.sysinit executes the /etc/rc.serial file.
The init command then runs the /etc/inittab script, which describes how the system should be set up in each SysV init runlevel. Runlevels are a state, or mode, defined by the services listed in the SysV /etc/rc.d/rc.d/ directory, where is the number of the runlevel.

Next, the init command sets the source function library, /etc/rc.d/init.d/functions, for the system, which configures how to start, kill, and determine the PID of a program.

The init program starts all of the background processes by looking in the appropriate rc directory for the runlevel specified as the default in /etc/inittab . The rc directories are numbered to correspond to the runlevel they represent. For instance, /etc/rc.d/rc5.d/ is the directory for runlevel 5.

看来了解了这个 init 文件,就对整个Linux的启动运行也有所了解了。

转至:http://apps.hi.baidu.com/share/detail/16017023
文章评论

共有 7 条评论

  1. wl0123abc 于 2012-03-28 21:48:51发表:

    是否是64位的系统,安装的时候,就有判断!
    关键是你的电脑的cpu是否支持64位的系统!

  2. 于 2012-03-27 22:56:37发表:

    uname -a

  3. pang15975386 于 2012-03-26 15:42:48发表:

    username$ gnome-system-monitor

  4. fern0004 于 2012-03-25 11:46:47发表:

    Hi, xiaomage119, thank you for the command:
    file /sbin/init
    my terminal shows:
    /sbin/init: ELF 32-bit LSB shared object, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.15, stripped

  5. fern0004 于 2012-03-25 11:40:34发表:

    HI, could you speak more simple?

  6. network_boy 于 2012-03-20 17:09:20发表:

    学习,学习!

  7. drivers 于 2012-02-22 11:12:16发表:

    没有标64的软件都装不了吗