Linux Shell Commands Part 2


In This Part I Will Discuss Usage Of Some Commands, Which Is sometimes required while working

COMPUTER KORNER

Lets start with 'uname' command

'uname' helps to get some information about the system

'uname' with no option, prints the kernel name

root@bt
:~#
uname
Linux

'uname' with parameter as '-s', prints the kernel name

root@bt
:~#
uname -s
Linux

'uname' with parameter as '-r' reveals the kernel release

root@bt
:~#
uname -r
2.6.38

'uname' with parameter as '-v' reveals the kernel version

root@bt
:~#
uname -v
#1 SMP Thu Mar 17 22:59:29 EDT 2011

'uname' with parameter as '-o' reveals the operating system name

root@bt
:~#
uname -o
GNU/Linux

'uname' with parameter as '-n' reveals the node name, or the hostname

root@bt
:~#
uname -n
bt

'uname' with parameter as '-a' reveals kernel name, hostname, kernel release, kernel version, kernel machine hardware, and Operating system
root@bt:~# uname -a
Linux bt 2.6.38 #1 SMP Thu Mar 17 22:59:29 EDT 2011 x86_64 GNU/Linux


Next, 'ifconfig' reveals the IP Address, If it doesnt show you the IP Address, the path to 'ifconfig' is not set in the environment variables, In Later Posts I will show how to set it, For now, if this doesnt display, you need to type, /sbin/ifconfig
root@bt:~# ifconfig
eth0      ...

lo        ....

ppp0    ...


Next, to check the Default Gateway Address, 'route' command is used

'route' with no parameters reveals the Address after resolving the DNS
root@bt:~# route
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
yy.
yy.yy.yy     *               xxx.xxx.xxx.xxx UH    0      0        0 ppp0
default        
yy.yy.yy.yy     0.0.0.0         UG    0      0        0 ppp0

'route' with '-n' parameters reveals the Address without resolving the DNS
root@bt:~# route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
yy.yy.yy.yy     0.0.0.0          xxx.xxx.xxx.xxx5 UH    0      0        0 ppp0
0.0.0.0        
yy.yy.yy.yy     0.0.0.0         UG    0      0        0 ppp0


Next, 'whoami' reveals the current user name

root@bt
:~#
whoami
root


Next, 'hostname' gives some juicy info about the system

'hostname' with -i reveals the address for the host

root@bt
:~#
hostname -i xxx.xxx.xxx.xxx

'hostname' with -I reveals the Common address for the host

root@bt
:~#
hostname -I xxx.xxx.xxx.xxx


'hostname' with '-f' reveals the Fully Qualified Domain Name

root@bt
:~#
hostname -f
bt.foo.org

'hostname' with '-s' reveals the hostname

root@bt
:~#
hostname -s
bt

'hostname' with '-d' reveals the domain name

root@bt
:~#
hostname -d
foo.org


Next, 'uptime' is used to check how long the system has been running, which also displays the Current Time, system status, uptime, number of users.
root@bt:~# uptime
 19:51:41 up  3:30,  4 users,  load average: 0.03, 0.07, 0.07


Next, to check the date and time, 'date' command is used
root@bt:~# date
Sat Jul  7 19:52:45 IST 2012

root@bt:~#

Thats All For This Post, Stay Tuned For More, Hope this was informative.

Feel Free To Leave A Comment
If Our Article has Helped You, Support Us By Making A Small Contribution, Thank You!

2 comments: