Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

show hard link number with -l (second column of ls -l) #407

Closed
M4tT3d opened this issue Aug 30, 2020 · 17 comments
Closed

show hard link number with -l (second column of ls -l) #407

M4tT3d opened this issue Aug 30, 2020 · 17 comments
Labels
good first issue Good for newcomers kind/feature New feature request

Comments

@M4tT3d
Copy link

M4tT3d commented Aug 30, 2020

excuse me. I know this is not the right section, but I would like to know how to show hard links too. In help I can't find anything and there is no manual. Thanks and sorry again

@meain
Copy link
Member

meain commented Sep 12, 2020

I am not sure if there is a standard way to do this, but you can check the inode number of files by using lsd -i and see if they are the same.

@sklages
Copy link

sklages commented Sep 30, 2020

Well that works for files in the same directory:

$ lsd -li s*
1803502 .rwxr-xr-x user_b user_b 2.7 KB Wed Sep 30 21:22:58 2020  run.hg38.sh
1787951 .rwxr-xr-x user_b user_b 1.5 KB Wed Sep 30 21:25:42 2020  run.mm10.sh
1787951 .rwxr-xr-x user_b user_b 1.5 KB Wed Sep 30 21:25:42 2020  run.mm10.sh.link

When files are not in the same directory, it gets complicated :-)

What @M4tT3d is referring to is to get column number two of ls -l:

-rwxr-xr-x 1 user_b user_b 2804 30. Sep 21:22 run.hg38.sh
-rwxr-xr-x 2 user_b user_b 1514 30. Sep 21:25 run.mm10.sh
-rwxr-xr-x 2 user_b user_b 1514 30. Sep 21:25 run.mm10.sh.link

@zwpaper zwpaper added kind/feature New feature request and removed need-more-info labels Oct 1, 2020
@zwpaper zwpaper changed the title show hard link with -l show hard link number with -l (second column of ls -l) Oct 1, 2020
@M4tT3d
Copy link
Author

M4tT3d commented Oct 29, 2020

Well that works for files in the same directory:

$ lsd -li s*
1803502 .rwxr-xr-x user_b user_b 2.7 KB Wed Sep 30 21:22:58 2020  run.hg38.sh
1787951 .rwxr-xr-x user_b user_b 1.5 KB Wed Sep 30 21:25:42 2020  run.mm10.sh
1787951 .rwxr-xr-x user_b user_b 1.5 KB Wed Sep 30 21:25:42 2020  run.mm10.sh.link

When files are not in the same directory, it gets complicated :-)

What @M4tT3d is referring to is to get column number two of ls -l:

-rwxr-xr-x 1 user_b user_b 2804 30. Sep 21:22 run.hg38.sh
-rwxr-xr-x 2 user_b user_b 1514 30. Sep 21:25 run.mm10.sh
-rwxr-xr-x 2 user_b user_b 1514 30. Sep 21:25 run.mm10.sh.link

Yes. It is exactly what I mean

@SturmB
Copy link

SturmB commented Nov 13, 2020

I, too, would love to see this feature added. It's the only thing that is preventing me from using lsd full-time instead of colorls.

@zwpaper zwpaper added the good first issue Good for newcomers label Nov 15, 2020
@TheAlakazam
Copy link
Contributor

Hey, I want to contribute to this issue. Is there a recommended way to go about implementing this or should I peruse the ls code base ?
P.S. I am new to Rust and I want to get started with contributing to Rust projects.

@zwpaper
Copy link
Member

zwpaper commented Dec 7, 2020

hi @TheAlakazam , Thanks for trying to implement this!

previously, I have done an inode options for lsd, it may not be the recommended way, but I could be a reference if needed.

#296

feel free to ask any questions

@tomWhilbert
Copy link

tomWhilbert commented Dec 7, 2020

I couldn't get the inode numbers to show with any combination of ls or lsd -i. My current workaround is an alias that uses command to ignore lsd for inode lists.
alias li=command ls -li

@meain
Copy link
Member

meain commented Dec 7, 2020

@tomWhilbert You might be using an older version of lsd. Version 0.18.0 has support for -i and --inode.

@tomWhilbert
Copy link

I have version 0.16.0 Its installed via Arch Community repo. Guess I'll wait for the update.

@meain
Copy link
Member

meain commented Dec 7, 2020

0.18.0 is available in AUR as of now.

@tomWhilbert
Copy link

I uninstalled with pacman and installed using cargo. All is good now, thanks.

@TheAlakazam
Copy link
Contributor

Hi, I wanted to ask if this should be implemented inside the INode struct, because hard link numbers is a part of the inode metadata ? The MetaDataExt crate has a method for getting the number of hardlinks to an inode.

@zwpaper
Copy link
Member

zwpaper commented Dec 13, 2020

maybe a standalone mod would be a better choice? The hard links number feels more like a standalone concept, although hard-linked files used the same inode number.

@meain
Copy link
Member

meain commented Dec 13, 2020

As @zwpaper suggested think we could keep it as a separate file as that way it would align with the idea of having one file per block (parsing, rendering etc). Also, we could add something like inode-count (better names welcome) for block name and an INodeCount enum in display.

@TheAlakazam
Copy link
Contributor

Ok, I will create a new mod. Names for the mod are welcome, even I am stumped as to what to name it. I will be going with INodeCount for now as per @meain's suggestion.

@meain
Copy link
Member

meain commented Feb 9, 2021

You can now do lsd --blocks permission,links,user,group,size,date,name or better, have this as the blocks in the config file to get the result you are looking for. This change is available currently in master and should be out in next release.
Decided to not add it to default long listing behavior for now. There is some color change planned and I thought it would be better if this lands fully after that.

@SturmB
Copy link

SturmB commented Mar 11, 2021

Looks like the change has made it into v0.20.1, @meain. From what I can see so far, the hardlink count is, indeed, working now. Thank you so much! 😃

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers kind/feature New feature request
Projects
None yet
Development

No branches or pull requests

7 participants