Wednesday, February 15, 2017

Day to Day usage commands in LInux ?


How to know the hostname of server ?

Command "hostname" will give you the host name of  the server. from the below example linuxtechnotes is the hostname of server.

[root@linuxtechnotes ~]# hostname
linuxtechnotes
[root@linuxtechnotes ~]#

How to know the present working directory ?

command "pwd" will give you current working directory . as per below example /root is the current directory .

[root@linuxtechnotes ~]#
[root@linuxtechnotes ~]# pwd
/root
[root@linuxtechnotes ~]#

How can we know who all logined to server currently ?
#who

[root@linuxtechnotes ~]# who
linuxtechnotes tty1         2017-02-10 22:03 (:0)
linuxtechnotes pts/0        2017-02-14 22:34 (:0.0)
root     pts/1        2017-02-15 20:55 (192.168.150.1)
[root@linuxtechnotes ~]#
[root@linuxtechnotes ~]#

How to know time and date in server ?

# date

[root@linuxtechnotes ~]# date
Wed Feb 15 20:58:10 PST 2017
[root@linuxtechnotes ~]#
[root@linuxtechnotes ~]#

How to know the current shell user login ?

#whoami

[root@linuxtechnotes ~]# whoami
root
[root@linuxtechnotes ~]#
[root@linuxtechnotes ~]#



How to get calender in server ?

#cal

[root@linuxtechnotes ~]#
[root@linuxtechnotes ~]#
[root@linuxtechnotes ~]# cal
    February 2017
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


How to use calculator in server ?

# bc

[root@linuxtechnotes ~]# bc
bc 1.06.95
Copyright 1991-1994, 1997, 1998, 2000, 2004, 2006 Free Software Foundation, Inc.
This is free software with ABSOLUTELY NO WARRANTY.
For details type `warranty'.
19-5
14
^C
(interrupt) Exiting bc.

How to check current terminal ?

#tty

[root@linuxtechnotes ~]# tty
/dev/pts/1

How to check total memory and its usage ?

# free -m /free -g

[root@linuxtechnotes ~]# free -m
             total       used       free     shared    buffers     cached
Mem:          1893        640       1253          3        130        328
-/+ buffers/cache:        180       1712
Swap:          511          0        511
[root@linuxtechnotes ~]#

How to check system uptime ?

#uptime

[root@linuxtechnotes ~]# uptime
 21:07:05 up 1 day, 18:01,  3 users,  load average: 0.00, 0.00, 0.00
[root@linuxtechnotes ~]#

How to check system kernel and Os details ?


[root@linuxtechnotes ~]# uname -a
Linux linuxtechnotes 2.6.32-504.el6.i686 #1 SMP Tue Sep 16 01:56:19 EDT 2014 i686 i686 i386 GNU/Linux
[root@linuxtechnotes ~]#
[root@linuxtechnotes ~]# uname -r
2.6.32-504.el6.i686
[root@linuxtechnotes ~]#
[root@linuxtechnotes ~]#



How to check when system was rebooted ?

#last | grep -i reboot

[root@linuxtechnotes ~]#
[root@linuxtechnotes ~]# last | grep -i reboot
reboot   system boot  2.6.32-504.el6.i Fri Feb 10 14:02 - 21:10 (5+07:08)
reboot   system boot  2.6.32-504.el6.i Sat Feb  4 06:25 - 21:10 (11+14:45)
reboot   system boot  2.6.32-504.el6.i Thu Feb  2 08:15 - 21:10 (13+12:55)
reboot   system boot  2.6.32-504.el6.i Sun Jan 29 02:42 - 21:10 (17+18:28)
[root@linuxtechnotes ~]#
[root@linuxtechnotes ~]#


How to check history of server who are all logined with time and date ?

#last 

[root@linuxtechnotes ~]# last | tail -10
root     pts/1        192.168.150.1    Thu Feb  2 16:26 - 19:22  (02:55)
root     pts/0        :0.0             Thu Feb  2 16:22 - crash (1+14:02)
root     tty1         :0               Thu Feb  2 16:22 - crash (1+14:03)
reboot   system boot  2.6.32-504.el6.i Thu Feb  2 08:15 - 21:11 (13+12:55)
root     pts/1        192.168.150.1    Sun Jan 29 20:57 - 21:45  (00:48)
linuxtec pts/0        :0.0             Sun Jan 29 15:36 - crash (3+16:39)
linuxtec tty1         :0               Sun Jan 29 15:35 - crash (3+16:39)
reboot   system boot  2.6.32-504.el6.i Sun Jan 29 02:42 - 21:11 (17+18:28)

wtmp begins Sun Jan 29 02:42:35 2017
[root@linuxtechnotes ~]#




No comments:

Post a Comment