Skip to content

Posts tagged ‘system admin commands’


10 System info Commands

10 System info Commands

If you are developing an application for Linux desktop and would like to automatically find out more information about system, use the following commands in shell scripts to gather information about system. Before applying a command you must know how to use the command effectively in Shell. Here we are explaing basich linux system commands and their usage.


This command will help you to find out your present working direcotry.

Command Usage:

[root@l3admins ~]# pwd
[root@l3admins ~]#

2. hostname

The kernel maintains the current (unqualified) hostname of the system. Before trying to set your hostname, it’s important to know how to tell when you’ve got it right. Here are a few of the numerous ways to obtain it:

Command Usage:

[root@l3admins ~]# hostname
[root@l3admins ~]#

3. whoami

This will display the login name like admin,root or your user name.

Command Usage:

[root@l3admins ~]# whoami
[root@l3admins ~]#

4. id
This command will display all the informations about a user like user ID, memeber of which Group and prints other user identity information

Command Usage:

 [root@l3admins ~]# id root
uid=0(root) gid=0(root) groups=0(root),1(bin),2(daemon),3(sys),4(adm),6(disk),10(wheel) context=root:system_r:unconfined_t:SystemLow-SystemHigh
[root@l3admins ~]#

5. date

This command will display the current date and timezone of your machine

Command Usage:

[root@l3admins ~]# date
Tue Jan  4 01:01:14 PST 2011
[root@l3admins ~]#

6. W

Its a command which conveys so many informations like load, number of users logged in, Uptime for the system.

[root@l3admins ~]# w
 01:46:06 up 59 min,  3 users,  load average: 0.00, 0.00, 0.04
USER     TTY      FROM              LOGIN@   IDLE   JCPU   PCPU WHAT
root     :0       -                00:49   ?xdm?  25.17s  0.39s /usr/bin/gnome-session
root     pts/1    :0.0             00:50   43:23   0.12s  0.12s bash
root     pts/2     01:03    0.00s  0.16s  0.01s w
[root@l3admins ~]#

7. finger

This is a user information lookup program, Finger displays the userâs login name, real name, terminal name and write status (as a ââ*ââ after the terminal name if write permission is denied), idle time, login time, office location and office phone number.

Command Usage:

[root@l3admins ~]# finger root
Login: root                             Name: root
Directory: /root                        Shell: /bin/bash
On since Tue Jan  4 00:49 (PST) on :0 (messages off)
On since Tue Jan  4 00:50 (PST) on pts/1 from :0.0
   49 minutes 26 seconds idle
On since Tue Jan  4 01:03 (PST) on pts/2 from
New mail received Fri Dec 31 02:30 2010 (PST)
     Unread since Sun Dec  5 08:36 2010 (PST)
No Plan.
[root@l3admins ~]#

8. last

This command will bring you the information about the last loggedin user.

Command Usage:

[root@l3admins ~]# last
root     pts/2     Tue Jan  4 01:03   still logged in
root     pts/1        :0.0             Tue Jan  4 00:50   still logged in
root     :0                            Tue Jan  4 00:49   still logged in
root     :0                            Tue Jan  4 00:49 - 00:49  (00:00)
reboot   system boot  2.6.18-194.el5   Tue Jan  4 06:18          (-4:-23)

9. lastb

This command will give you the information about the last bad (unsuccessful) login attempts to the machine.

Command Usage:

[root@l3admins ~]# lastb
root     ssh:notty     Tue Jan  4 01:58 - 01:58  (00:00)
root     ssh:notty     Tue Jan  4 01:58 - 01:58  (00:00)

btmp begins Tue Jan  4 01:58:31 2011
[root@l3admins ~]#

10. free

Memory info (in kilobytes). “Shared” memory is the memory that can be shared between processes (e.g., executable code is “shared”). “Buffered” and “cashed” memory is the part that keeps parts of recently accessed files – it can be shrunk if more memory is needed by processes.

Command usage:

[root@l3admins ~]# free
             total       used       free     shared    buffers     cached
Mem:       1035108     655116     379992          0      88648     410024
-/+ buffers/cache:     156444     878664
Swap:      2096472          0    2096472
[root@l3admins ~]#