Flat 80% OFF + Addl. 10% OFF on All EICT (IIT Roorkee) Courses. Use Coupon Code 10PLUS during Checkout | Expires in

 Enroll Now

Linux Basics

83 / 87
   

Where is my program?

To find where is your program located, you can use "which" command.

For example,

which java

would print "/usr/bin/java" which means java is a command in the directory "/usr/bin".

To further find out, you can use:

ls -l /usr/bin/java

This would display:

lrwxrwxrwx 1 root root 22 May 18  2016 /usr/bin/java -> /etc/alternatives/java

It mean that /usr/bin/java is actually a link to /etc/alternatives/java

Let us try:

ls -l /etc/alternatives/java

It should display something like:

lrwxrwxrwx 1 root root 72 May 18  2016 /etc/alternatives/java -> /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.212.b04-0.el7_6.x86_64/jre/bin/java

Further, to find out about the content of a file, you can use "file" command:

file /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.212.b04-0.el7_6.x86_64/jre/bin/java

This should display something like

/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.212.b04-0.el7_6.x86_64/jre/bin/java: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.32, BuildID[sha1]=df3fba6cc0f63b51a2270014a3994480680a8ca0, stripped

This means it is Linux binary.