Finding file version in linux

Viewing Linux Library / Executable version info

The version info in not explicitly stored in an ELF file. What you have in there is the name of the library, the soname , which includes the major version. The full version is usually stored as a part of the library file name.

If you have library, say libtest.so , then you usually have:

  • libtest.so.1.0.1 — The library file itself, containing the full version
  • libtest.so.1 — Symlink to libtest.so.1.0.1 , having the same name as soname
  • libtest.so — Symlink to libtest.so.1 used for linking.

In the library file libtest.so.1.0.1 , there will be an entry called SONAME in dynamic section, that will say this library is called libtest.so.1 . When you link a program against this library, the linked program will store the soname of the library under NEEDED entry in the dynamic section.

If you want to verify, what exactly is in which ELF file, you can try to run:

where elffile can be either an library of an executable.

If you simply want to get the library version, you can play with:

readelf -d /path/to/library.so |grep SONAME 

AFAIK, there’s no such info (at least not by default) in executable files.

Or you can rely on the program itself or your packaging system, as Rahul Patil wrote.

nice info, it’s new to me never used readelf, if you don’t mind , may i ask you where & why use readelf

Readelf (and similar tools) is useful, when you want to look inside an elf file :). I use it mostly when programming to look up symbols in libraries (when something doesn’t work), or when there’s some problem with a library. (man readelf)

You can use ldconfig -v | grep libraryname , also command has option command -V or binaryfile —version

test@ubuntukrb12:~# ls --version ls (GNU coreutils) 8.13 Copyright (C) 2011 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later . This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. 

also you can use yum or aptitude based on distro you are using eg.

in RHEL5/CENTOS5/Fedora you can use yum info packagename or if it installed then use rpm —version packagename

 [root@ldap1 ~]# yum info bind97 Loaded plugins: downloadonly, fastestmirror, security Loading mirror speeds from cached hostfile * base: mirrors.sin3.sg.voxel.net * epel: mirror.imt-systems.com * extras: mirrors.sin3.sg.voxel.net * updates: mirrors.sin3.sg.voxel.net Installed Packages Name : bind97 Arch : i386 Epoch : 32 Version : 9.7.0 Release : 10.P2.el5_8.4 Size : 6.3 M Repo : installed Summary : The Berkeley Internet Name Domain (BIND) DNS (Domain Name System) server URL : http://www.isc.org/products/BIND/ License : ISC Description: BIND (Berkeley Internet Name Domain) is an implementation of the DNS : (Domain Name System) protocols. BIND includes a DNS server (named), : which resolves host names to IP addresses; a resolver library : (routines for applications to use when interfacing with DNS); and : tools for verifying that the DNS server is operating properly. 

In Ubuntu You can use aptitude show pkgname or dpkg —version pkgname

root@ubuntukrb12:~# aptitude show bind9utils Package: bind9utils State: installed Automatically installed: yes Version: 1:9.8.1.dfsg.P1-4ubuntu0.4 Priority: optional Section: net Maintainer: Ubuntu Developers Architecture: amd64 Uncompressed Size: 306 k Depends: libbind9-80, libc6 (>= 2.14), libdns81, libisc83, libisccc80, libisccfg82 Conflicts: bind9utils Replaces: bind9 ( 

Источник

How do I find the version of a file in Linux?

Open the app that you are interested in and then look for the Settings button. It should be somewhere in the user interface. Click or tap on it and then look for the About section. Click or tap About and there you will find the version of the application that you are using.

What is the command to check Unix version?

Just type the hostnamectl command to check OS name and Linux kernel version.

How do I view a file in Unix?

In Unix to view the file, we can use vi or view command . If you use view command then it will be read only. That means you can view the file but you will not be able to edit anything in that file. If you use vi command to open the file then you will be able to view/update the file.

What is the latest version of Kali Linux?

Kali 2019.4 – 26th November, 2019 – The fourth 2019 Kali Rolling release. Kernel 5.3. 9, Xfce 4.14. 1….

  • Kali 2018.4 – 29th October, 2018 – The fourth 2018 Kali Rolling release.
  • Kali 2018.3 – 27th August, 2018 – The third 2018 Kali Rolling release.

How do I check my version of CMD?

Checking your Windows version using CMD Enter cmd and click [OK] to open Windows Command Prompt. Type systeminfo in the command line and hit [Enter] to execute the command.

How do I know what software is on my computer?

Click the Start or Windows button (usually in the lower-left corner of your computer screen). Click Settings….

  1. While on the Start screen, type computer.
  2. Right-click the computer icon. If using touch, press and hold on computer icon.
  3. Click or tap Properties. Under Windows edition, the Windows version is shown.

What is the latest version of Unix?

There are many different versions of UNIX. Until a few years ago, there were two main versions: the line of UNIX releases that started at AT (the latest is System V Release 4), and another line from the University of California at Berkeley (the latest version is BSD 4.4).

Which command is used to display OS?

uname command
To display the name of the operating system, use the uname command.

What is VIEW command?

The view command starts the vi full-screen editor in read-only mode. The read-only mode is only advisory to prevent accidental changes to the file. To override read-only mode, use the ! (exclamation point) when executing a command. The File parameter specifies the name of the file you want to browse.

How do you check disk space in Unix?

How do I search for a file in Unix?

What is the command to check the version of Linux?

How do I check Linux OS?

Источник

Extracting version number from a filename

where XXX.XX is a version number and I need the version number only. How to do it in linux? I have this code:

#!/bin/bash current_ver=$(find /mnt/builds/current -name '*.run'|awk -F/ '') 

So this gives me just the name of the file correctly (minus the location, which I don't want). But how do I only get the XXX.XX version number into a variable such as $version

4 Answers 4

You actually don't need any external tools. You can do this entirely within bash, by chopping variables according to patterns..

[ghoti@pc ~]$ name="installer-x86_64-XXX.XX-diagnostic.run" [ghoti@pc ~]$ vers=$; echo $vers x86_64-XXX.XX-diagnostic.run [ghoti@pc ~]$ vers=$; echo $vers XXX.XX-diagnostic.run [ghoti@pc ~]$ vers=$; echo $vers XXX.XX [ghoti@pc ~]$ 

Or if you prefer, you can chop off pieces right-hand-side first:

[ghoti@pc ~]$ name="installer-x86_64-XXX.XX-diagnostic.run" [ghoti@pc ~]$ vers=$; echo $vers installer-x86_64-XXX.XX [ghoti@pc ~]$ vers=$; echo $vers XXX.XX [ghoti@pc ~]$ 

Of course, if you want to use external tools, that's fine too.

[ghoti@pc ~]$ name="installer-x86_64-XXX.XX-diagnostic.run" [ghoti@pc ~]$ vers=$(awk -F- '' <<<"$name") [ghoti@pc ~]$ echo $vers XXX.XX [ghoti@pc ~]$ vers=$(sed -ne 's/-[^-]*$//;s/.*-//;p' <<<"$name") [ghoti@pc ~]$ echo $vers XXX.XX [ghoti@pc ~]$ vers=$(cut -d- -f3 <<<"$name") [ghoti@pc ~]$ echo $vers XXX.XX [ghoti@pc ~]$ 

Источник

UNIX for Dummies Questions & Answers

Member Information Avatar

22, 0

Question

Finding file version info

Is there a standard command for retrieving the version of any given file (assuming the file has a version)?

Member Information Avatar

11,728, 1,345

Some source control apps embed a version header in source code. Some programmers do as well. Some files have the compile-time embedded as a reference.

If you think version info exists, start with ident then maybe try what

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Finding SSL Cert Info

How do I find out the SSL cert info on the local server? How do I know if an ssl cert is installed on local server? How it was issued to? Who was the issuer? What's the expiration date? Any other relevant information? (1 Reply)

Discussion started by: scj2012

2. Shell Programming and Scripting

Help with finding the latest modified version of a file within directories

I am trying to look into multiple directories and pluck out the latest version of a specific file, regardless of where it sits within the directory structure. Ex: The file is a .xls file and could have a depth within the directory of anywhere from 1-5 Working directory - Folder1. (6 Replies)

Discussion started by: co21ss

3. Linux

Finding IP info from access_log file

I found the /var/www/logs/access_log file (access log in order to find specific information about IP, And when users last logged in.) but in my fedora the access_log file is is in my /var/log/cups and it looks different from what it should be. Why is that? my goal is to get a list of IP. (4 Replies)

Discussion started by: bugenhagen_

4. Shell Programming and Scripting

perl Net::SNMP version getting info from cisco switch

I am having trouble working with SNMP module with perl. I am trying to get SNMP version of target system. I use following code to get it however it resturns error as "Argument "v6.0.1" isn't numeric in numeric lt (<) at ./chk_env_upd.pl line 447." Get load table my $resultat =. (1 Reply)

Discussion started by: dynamax

5. UNIX for Dummies Questions & Answers

Need help with finding info on pcode-interpreters-virtual machines

I'm trying to research interpreters and I can't find much info on Pcode or how or why it is used. Thanks in advance!:wall: (2 Replies)

Discussion started by: theKbStockpiler

6. Shell Programming and Scripting

Help finding info from log file

Hi, I have a log file that contains information such as this: date id number command1 command2 command3 command4 data data data date id number command1 command2 command3 command4 (4 Replies)

Discussion started by: bbbngowc

7. Shell Programming and Scripting

Finding consecutive numbers in version names on a txt file

Hi all. I have a directory which contains files that can be versioned. All the files are named according to a pattern like this: TEXTSTRING1-001.EXTENSION TEXTSTRING2-001.EXTENSION TEXTSTRING3-001.EXTENSION . TEXTSTRINGn-001.EXTENSION If a file is versioned, a file called . (10 Replies)

Discussion started by: fox1212

8. HP-UX

How to find tcsh shell version info in HP-UX?

Hi, I need to find tcsh shell version info on several boxes. I made a script and running on boxes through SSH. This is what i am doing : echo /bin/tcsh -c 'echo $version' | ssh "box name" but i dont see anything. if i run /bin/tcsh -c 'echo $version' on ocal machine i see the. (2 Replies)

Discussion started by: kailash19

9. Shell Programming and Scripting

Finding & Moving Oldest File by Parsing/Sorting Date Info in File Names

I'm trying to write a script that will look in an /exports folder for the oldest export file and move it to a /staging folder. "Oldest" in this case is actually determined by date information embedded in the file names themselves. Also, the script should only move a file from /exports to. (6 Replies)

Discussion started by: nikosey

10. UNIX for Dummies Questions & Answers

Finding system info

Can someone tell me the command to display the info about the CPU? I need the CPI id.. of my SUN box. Solaris 8. It's some totally un-intuitive command, and i can't recall it. tnx. (3 Replies)

Источник

Читайте также:  Canon laserbase mf3228 драйвер linux
Оцените статью
Adblock
detector