您的位置:首页 > 运维架构 > Linux

How to check system status with basic Linux utilities.

2015-10-30 10:18 423 查看

Some Basic commands to check System status:

uptime – shows how long the system
has been up

who- shows who is
logged into the system

uname- print system
information

runlevel – report previous and
current Unix OS runlevel

uptime:

uptime is one of the basic Unix commands which allows you to quickly confirm
how long your Unix system has been up and running since it was last rebooted or
powered on. For Example:
[root@server]# uptime
11:52:22 up 3 days 32 min,  4 users,  load average: 0.02, 0.04, 0.11
Details:
11:52:22 – that's the current Unix system
time
up 3 days, 32 min – shows for how long your system has been
running
4 users – number of users currently logged into your Unix
system
load average: 0.02, 0.04, 0.11 – the average CPU load (average
number of jobs in your system's run queue)for the 1, 5 and 15 minutes

who:

who is one of basic commands, which allows you to quickly see who else is
logged in. When you run who without any parameters, it returns you a list of
users on your Unix system, along with terminals they're using, the time of the
start for each session, and the hostnames where these users are logged in
from.
[root@server ~]# who
jeet     tty7         2011-06-21 11:21 (:0)
groot     tty1       2011-06-21 11:10  (:0)


uname:

uname is one of the most useful commands when it comes to gathering basic
information about your system. You can use it to find out the hostname of the
system you're on, the hardware architectures supported by the currently used
kernel and the exact release of your system.

For Example:
1) To see
the node (host) name of your system:
[root@server ~]# uname -n
server.example.com
2) To find out the hardware platform of your system:
For Linux, it will
return i386 for 32-bit processors or x86_64 for 64-bit ones:
[root@server ~]# uname -i
x86_64
3) To find out the release and version of your kernel, you can use uname -r
and uname -v.
[root@server ~]# uname -r
2.6.38-8-server

[root@server ~]# uname -v
#42-Ubuntu SMP Mon Apr 11 03:49:04 UTC 2011
4) You can use uname -a to output everything it knows about your
system.
[root@server ~]# uname -a
Linux server 2.6.38-8-server #42-Ubuntu SMP Mon Apr 11 03:49:04 UTC 2011 x86_64 x86_64 x86_64 GNU/Linux


runlevel:

runlevel reports the runlevel of your Linux system. runlevel command reads
/var/run/utmp file and extracts the most recent login entry. It then uses
this entry to extract the current and previous runlevel information from
it.

For Example:
[root@server ~]# runlevel
N 5
Note: The two numbers shown are supposed to be previous and current Unix
runlevels. However, the previous runlevel information is not usually found in
the most recent login entry simply because runlevel hasn't changed, so the
command prints "N" instead of it. Looking at the output above, you can see that
the current runlevel is 5.
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: