Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'm trying to type 'realpath' in CentOS 6.5. But it seems not installed. I checked it is contained in coreutils (archlinux). I double check the coreutils package which provide by CentOS, it lack the /usr/bin/realpath. I don't want to install 3rd party rpm like 'http://pkgs.org/centos-6/repoforge-x86_64/realpath-1.17-1.el6.rf.x86_64.rpm.html'.

I've did yum search realpath, can not found it. Is the utility contains in other package? Or just be removed for security reason?

share|improve this question
    
Try sudo yum provides -C realpath to see which package it is in; then install it (or try re-installing if it is already installed). –  BenjiWiebe Jun 20 at 3:38
    
yum provides -C /usr/bin/realpath Loaded plugins: fastestmirror, refresh-packagekit, security No Matches found –  Daniel YC Lin Jun 20 at 4:41
    
@DanielYCLin Can't you simply use readlink -e? It is exactly the same thing. –  MariusMatutiae Jun 20 at 6:05
    
@MariusMatutiae please write as answer, I'm writing my script, so, it is possible to use readlink if centos 6.5 support it. –  Daniel YC Lin Jun 20 at 16:56
    
@DanielYCLin I have done so, as per your request. –  MariusMatutiae Jun 20 at 17:11

2 Answers 2

up vote 2 down vote accepted

realpath is a very useful tool, however most of its functionalities were already present with readlink. The realpath man page states:

Please note that mostly the same functionality is provided by the '-e' option of the readlink(1) command.

And the readlink man page states:

-e, --canonicalize-existing: canonicalize by following every symlink in every component of the given name recursively, all components must exist.

The readlink command was added to coreutils, AFAIK, in 2008: it is surely available in Ubuntu Hardy 8.04. So if you do not have realpath, it is possible that you have readlink immediately available.

share|improve this answer

The realpath tool was added to GNU coreutils in version 8.15 (commit 77ea441f79aa), released in 2012. Your CentOS release likely has coreutils v8.4. The tool wasn't removed; it was not yet added in the first place.

share|improve this answer
    
So, 'realpath' is not contained in centos official repository. Install 3rd party rpm is the only way? –  Daniel YC Lin Jun 20 at 5:50
    
@DanielYCLin You could just download it from ftp.gnu.org, run tar -xJf coreutils-8.22.tar.xz; ./configure; make; sudo make install. It will put it in /usr/local/bin which is likely in your PATH (if not, you can add it). –  BenjiWiebe Jun 23 at 12:35

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.