Basic Linux System Commands

Some Basic Linux System Commands


Display Linux System Information

[root@web-server ~]# uname -a
Linux web-server.novalocal 3.10.0-229.4.2.el7.x86_64 #1 SMP Fri Apr 24 15:26:38 EDT 2015 x86_64 x86_64 x86_64 GNU/Linux

Display Kernel Release Information

[root@web-server ~]# uname -r
3.10.0-229.4.2.el7.x86_64

Shows how long system has been running plus system load

[root@web-server ~]# uptime
09:36:13 up 17 days, 15:25,  1 user,  load average: 0.05, 0.09, 0.14

Shows system hostname

[root@web-server ~]# hostname
web-server.novalocal  

Display IP address of host

[root@web-server ~]# hostname -i
fe80::f816:3eff:fee7:bf9b%eth0 172.25.1.104  

Shows system reboot history

[root@web-server ~]# last reboot
reboot   system boot  3.10.0-229.4.2.e Wed May 20 18:11 - 09:35 (17+15:24)  
reboot   system boot  3.10.0-123.9.3.e Wed May 20 13:00 - 18:10  (05:10)  
reboot   system boot  3.10.0-123.9.3.e Tue Feb 24 17:59 - 18:10 (85+00:11)  
reboot   system boot  3.10.0-123.9.3.e Wed Nov 19 11:09 - 18:10 (182+07:01)  
reboot   system boot  3.10.0-123.9.3.e Sun Nov 16 14:36 - 11:09 (2+20:32)  
reboot   system boot  3.10.0-123.9.3.e Fri Nov 14 14:54 - 11:09 (4+20:15)  
reboot   system boot  3.10.0-123.8.1.e Fri Nov 14 12:45 - 14:53  (02:08)  

Shows current date and time

[root@web-server ~]# date
Sun Jun  7 09:37:40 IST 2015  

Shows current date and time in UTC

[root@web-server ~]# date --utc
Sun Jun  7 04:07:56 UTC 2015  

Shows calendar of the month

[root@web-server ~]# cal
      June 2015   
Su Mo Tu We Th Fr Sa  
    1  2  3  4  5  6
 7  8  9 10 11 12 13
14 15 16 17 18 19 20  
21 22 23 24 25 26 27  
28 29 30  

Display who is logged in

[root@web-server ~]# w
 09:38:56 up 17 days, 15:27,  1 user,  load average: 0.08, 0.12, 0.14
USER     TTY      FROM             LOGIN@   IDLE   JCPU   PCPU WHAT  
cloud-us pts/0    x.x.x.x  09:35    0.00s  0.10s  0.14s sshd: cloud-user [priv]  

Display who you are logged in as

[root@web-server ~]# whoami
root  

Like it? Click here to Tweet your feedback

Swapnil Jain

RHCA Level IX, RHCI ♦ Solution Architect ♦ DevOps Trainer & Consultant