diff --git a/crates/nu-cli/src/shell/filesystem_shell.rs b/crates/nu-cli/src/shell/filesystem_shell.rs index 98f825fd09..0d1a41068a 100644 --- a/crates/nu-cli/src/shell/filesystem_shell.rs +++ b/crates/nu-cli/src/shell/filesystem_shell.rs @@ -874,8 +874,18 @@ pub(crate) fn dir_entry_dict( #[cfg(unix)] { for column in [ - "name", "type", "target", "readonly", "mode", "uid", "group", "size", "created", - "accessed", "modified", + "name", + "type", + "target", + "num_links", + "readonly", + "mode", + "uid", + "group", + "size", + "created", + "accessed", + "modified", ] .iter() { @@ -942,6 +952,9 @@ pub(crate) fn dir_entry_dict( UntaggedValue::string(umask::Mode::from(mode).to_string()), ); + let nlinks = md.nlink(); + dict.insert_untagged("num_links", UntaggedValue::string(nlinks.to_string())); + if let Some(user) = users::get_user_by_uid(md.uid()) { dict.insert_untagged( "uid", diff --git a/crates/nu-cli/tests/commands/ls.rs b/crates/nu-cli/tests/commands/ls.rs index 94829aa2ef..fddf34554d 100644 --- a/crates/nu-cli/tests/commands/ls.rs +++ b/crates/nu-cli/tests/commands/ls.rs @@ -279,8 +279,18 @@ fn list_all_columns() { #[cfg(unix)] { [ - "name", "type", "target", "readonly", "mode", "uid", "group", "size", - "created", "accessed", "modified", + "name", + "type", + "target", + "num_links", + "readonly", + "mode", + "uid", + "group", + "size", + "created", + "accessed", + "modified", ] .join("") }