歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux基礎 >> Linux教程 >> 查看Linux系統是否為64位的方法

查看Linux系統是否為64位的方法

日期:2017/2/28 16:32:51   编辑:Linux教程

可以直接使用 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<x>.d/ directory, where <x> 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的啟動運行也有所了解了。

Copyright © Linux教程網 All Rights Reserved