Skip to main content

Questions tagged [coreutils]

GNU Core Utilities are the GNU project's implementation of the core command-line tools of a POSIX system, including tools like ls, cp, mv, rm, etc.

Filter by
Sorted by
Tagged with
10 votes
3 answers
2k views

GNU sort command does not sort words of different lengths with common prefixes correctly when using field delimiter

The GNU sort command is not sorting words of different lengths with common prefixes correctly for me, but only when using a field delimiter to sort on one of multiple fields. Here is the correct, ...
Ben McIlwain's user avatar
1 vote
2 answers
93 views

Where do I find documentation for the output of ls -l?

There have been multiple questions asked about this, like Understanding ls output, What are columns in ls -la?, What does 'ls -la' do?, What do the fields in ls -al output mean?, etc.. I've also come ...
TrisT's user avatar
  • 121
5 votes
1 answer
450 views

ls output display a file named "N'*" as "N'\''*"

System: Ubuntu 22.04.3 LTS GNU bash, version 5.1.16(1)-release (x86_64-pc-linux-gnu) ls (GNU coreutils) 8.32 Situation: $ touch "N'*" $ ls 'N'\''*' "GNU Coreutils - Quoting File ...
yossi-matkal's user avatar
0 votes
3 answers
74 views

What is the maximum amount of files GNU core utils can split a file into in 1gb filesize each?

I want to know what kinds of limits i have . I saw it has a alphabet system a-z and then increment the second letter by 1 (xay -> xaz -> (havent seen but assume) xba -> xbb)
mean mean's user avatar
9 votes
1 answer
957 views

GNU Coreutils `\time --version` and `/bin/true --version` work but `\true --version` does not?

$ \time --version time (GNU Time) UNKNOWN Copyright (C) 2018 Free Software Foundation, Inc. ... $ /bin/true --version true (GNU coreutils) 8.32 Copyright (C) 2020 Free Software Foundation, Inc. ... $...
charmoniumQ's user avatar
2 votes
2 answers
137 views

Why is there manpage for sync(1) and sync(8) and how do they differ?

I see there are two different utilities in Linux manpages and I don't understand the difference. There is sync(1) and sync(8), and they look eerily similar. https://linux.die.net/man/8/sync https://...
Karel Bílek's user avatar
  • 1,961
0 votes
1 answer
69 views

Is there a command that makes another command "in-place"?

I find myself trying to "edit" a file in-place quite a lot in my shell. Say, I want to remove all lines in words.txt that contain the letter e. Then, I would execute: $ grep -v e words.txt &...
Lorenz Leutgeb's user avatar
0 votes
1 answer
76 views

What is the default behavior of GNU cp when copying from a symbolic link?

Can someone elaborate on this description in the official docs? When copying from a symbolic link, cp normally follows the link only when not copying recursively or when --link (-l) is used.
joe's user avatar
  • 53
1 vote
1 answer
147 views

Can I force numfmt to always output a number scaled to Kilo instead of the auto-scale?

Can I make numfmt output the input number scaled to Kilo even when it is in another range, like in this sample Giga? > LC_NUMERIC="en_US.UTF-8" numfmt --to=si --format=%.6f --suffix=Wh ...
user640916's user avatar
2 votes
0 answers
615 views

What is the exact source of Architecture info in lscpu command

Tl;dr I need to mock info about CPU architecture on the server for testing purpose. The only way that I can achieve it, is by changing info source about CPU architecture, that is used by lscpu command ...
mindgod's user avatar
  • 21
0 votes
2 answers
782 views

BusyBox's tar --exclude doesn't exclude

Extract a tar file with content dir1/dir2/file, using --exclude dir2 switch. The gnu tar excluded but busybox's tar doesn't. Use --exclude dir1/dir2 works fine, but why? Is there a way to exclude any ...
kkocdko's user avatar
  • 101
4 votes
2 answers
4k views

What precisely does cp -b (--backup) actually do?

Before you hit me with the obvious, I know, the backup option makes a backup of a file. But the thing is, the cp command in general backs up a file. One could argue a copy of a file is a backup. So ...
backslash enn's user avatar
3 votes
1 answer
2k views

How do I use modern coreutils on Mac?

How do I get modern coreutils on mac? I ran into this problem using csplit: foo.txt: foo 1 foo 2 foo 3 $: csplit foo '^foo$' '{*}' # error Double checking the manpage, man csplit, csplit on Mac is ...
Chris's user avatar
  • 983
-4 votes
3 answers
645 views

coreutils ls summary

Why is there no summary option in coreutils ls command, like MS-DOS/Windows has? With summary option I mean: count the files and dirs and sum up their sizes. Update: It should read: "Even DOS/...
bashianer's user avatar
  • 153
0 votes
0 answers
14 views

How to escape standard input when "cat f - g" [duplicate]

man cat shows the following example: cat f - g Output f's contents, then standard input, then g's contents. How do you escape the standard input and proceed to output the 2nd ...
MattP's user avatar
  • 111
2 votes
0 answers
188 views

Does mv across filesystems flush the destination filesystem cache between copy and delete?

mv is implemented as a simple rename() whenever possible, falling back to copy-then-delete whenever renaming doesn't work. In practice (but not in theory), these two cases correspond to source and ...
smheidrich's user avatar
-1 votes
2 answers
303 views

Use Git Version of mv/rm etc When in Repository

Git has its own versions of commands such as mv and rm that we really ought to use when doing these operations inside repositories. However, I'm sure I'm not the only person who often forgets to do ...
ScottishTapWater's user avatar
0 votes
2 answers
83 views

Using cp -u but only if content is different

How to use cp -u to only copy if content is different, it fails when doing as below $ cd /tmp/exper ; cp -v ~/Downloads/C/test.c . ; sudo chmod -R 777 . /home/budi/Downloads/C/test.c -> 'test.c' $ ...
user avatar
2 votes
0 answers
196 views

What dictates the order of group listing with id and groups command

I am trying to work out what order the groups are listed by id and groups command (coreutils v8.22) I am using LDAP and have configured SSSD to read user and group information. My ldap server always ...
Rendalf's user avatar
  • 39
0 votes
3 answers
154 views

Seq but multiplying by the step instead of adding it

seq "prints a sequence of numbers to standard output", and, as far as I know, it can only increment the counter by adding. For instance, seq 0 3 10 0 3 6 9 tells seq to count from 0 to 10 ...
Clément's user avatar
  • 378
1 vote
1 answer
102 views

Why do I need to specify `-o auto` for join's `-e` option to work?

With the following two simple files: a.txt 1 a 2 b 5 c b.txt 2 x 4 y 5 z The following command does not behave like expected: $ join -a 1 -a 2 -e 0 a.txt b.txt 1 a 2 b x 4 y 5 c z I would expect ...
iago-lito's user avatar
  • 2,811
9 votes
3 answers
3k views

Move files to directory based on extension (zsh, macOS)

I want to have a script to automatically move all files into a directory structure that I have in place (it looks like ~/jpg, ~/png, ~/mp3, ~/zip, and so on).  So far, this is almost doing exactly ...
user69136's user avatar
  • 113
1 vote
3 answers
161 views

Is there a unified stdout data format (for consistent/easy parsing) for core linux commands?

It seems that each core Linux command has a different stdout format. Also, these formats are not always easily/safely/consistently parsed by other scripts/apps. Is there a wrapper or specification or ...
Guy Langston's user avatar
3 votes
1 answer
166 views

ln: create relative symlink to a relative symlink

I want to create a relative symlink pointing to a relative symlink, not to the relative symlink's target. It seems that when creating a relative symlink ln resolves TARGET instead of pointing to the ...
matt's user avatar
  • 547
0 votes
1 answer
477 views

How to intercept file descriptor of file opened with inotify or others on access?

I just finished an Operating Systems course at my University, and I want to start playing with systems level programs with Rust. One of things I'm looking for is how to intercept a file descriptor of ...
Matanya's user avatar
  • 197
0 votes
3 answers
904 views

Is there a Linux command that removes just the first character of every file?

Is there a Linux command that can remove the first character on the first line for every file in a folder, and then save it? Many online resources cover doing this for every line instead of just the ...
ojbqa's user avatar
  • 3
1 vote
1 answer
793 views

Preserve permissions and ownership with install command

When running install (GNU Coreutils implementation), I'd like to know if it is possible to preserve ownership and permissions of the source files. I know that by default it installs as 755, and you ...
Daniel M.'s user avatar
  • 307
2 votes
1 answer
159 views

If the `-p` flag not needed anymore in `mkdir` 9.0?

I can't find any reference of this change of behaviour $ mkdir --version mkdir (GNU coreutils) 9.0 Copyright (C) 2021 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <...
Jon's user avatar
  • 123
-1 votes
1 answer
796 views

How can I display directory file counts recursively with the ls command? [closed]

Under bash in Ubuntu, I want to ls -lah a directory and have it display file counts for directories recursively. That's to say I want it to count all files in the directories and their subdirectories....
Duncan Marshall's user avatar
3 votes
0 answers
529 views

Are there any "richer" alternatives to cp and mv (like bat to cat and exa to ls)?

ls has exa. cat has bat. I don't know of a direct alternative to rm, but it also has rmtrash. All of these can usually work as drop-in alias replacements, retaining usual function and options of their ...
Atai Ambus's user avatar
0 votes
1 answer
253 views

Help me understand a script that uses csplit and sed

I wanted a simple way to export notes from the reference manager, Zotero. I start by selecting multiple notes and dragging them into a blank text file. I also want achieve "atomicity" of my ...
Christopher J Poor's user avatar
2 votes
1 answer
1k views

How to treat a symbolic link as a file itself (instead of the one it points to)?

Out of curiosity i wanted to open a symlink as itself instead of the file it points to, just to see how it looks like. While there are ways to see what file it points to like using readlink and ways ...
Carla only proves trivial prop's user avatar
-1 votes
2 answers
2k views

ls: unparsable value for LS_COLORS environment variable zshell in fedora 33

I'm using zshell in fedora 33 OS. I've the configuration in my ~/.zshrc file Whenever I run ls command I get below error - ls: unparsable value for LS_COLORS environment variable How can I fix this ...
Rajkumar Natarajan's user avatar
1 vote
0 answers
533 views

Is jq internal sort slower than GNU sort?

While filtering through this json file I did a benchmark and found out utilizing jq's internal sort and unique method is actually 25% slower than sort --unique! Command Mean [ms] Min [ms] Max [ms] ...
Zeta.Investigator's user avatar
3 votes
1 answer
1k views

GNU cp: What's the difference between `--link` and `--reflink=always`?

What's the difference between --link and --reflink=always? I use the following command as an mv substitute, and I am wondering if using --reflink is a better choice. command gcp -r --link --archive --...
HappyFace's user avatar
  • 1,620
0 votes
4 answers
372 views

what timedate value is always greater than any timedate?

What timedate value is always greater than any timedate? In a script, I want to provide an argument to variable duration so that the loop will run forever until I kill the process: # `duration` has a ...
Mary's user avatar
  • 1
1 vote
2 answers
337 views

Making ls do a reasonable sort order, but not print Greek characters as "??"

Suppose I have the following files in a directory _y a b c x z β The following command lists them in the above order, as God intended: perl -e '@files = <*>; print join(" ",sort @...
user avatar
0 votes
2 answers
76 views

coreutils date does not return time zone when called from script

In terminal, the output of the lines TZ="Australia/Broken_Hill" date -d '2021-4-26 09:29' TZ="Australia/Broken_Hill" date -d '2021-4-26 09:29' +%Z is Mon Apr 26 09:29:00 AM ACST ...
Chris's user avatar
  • 3
1 vote
1 answer
2k views

What is %z useful for in GNU date?

I'm in the UK running these 2 commands (using gdate as I'm on a Mac with date (GNU coreutils) 8.32 installed): # A UK winter date, timezone in UK at this time is GMT = UTC $ gdate '--date=TZ="...
Matt's user avatar
  • 561
1 vote
0 answers
56 views

Inconsistent output of cp -v command between machines

On two different machines I maintain, cp -v's output is different. On one box, both src and dest are quoted, on another box, the first quote around both src and dest is a backtick: Box one (recent ...
wzzrd's user avatar
  • 3,720
2 votes
1 answer
514 views

Interleaving two binary files by fixed-size blocks

We have paste(1) which can interleave files by lines. Out of curiosity, I wonder if there's some binary equivalent. It should copy the first N bytes from file A to stdout, then the first N bytes of ...
7efkvNEq's user avatar
  • 121
0 votes
0 answers
39 views

man -k . is not working in gnu/linux [duplicate]

I am using manjaro and when i try command man -k . or apropos . or man -k . -s 2 to see all man pages it's giving me error like .: nothing appropriate. is it man different because i gnu coreutils ? ...
Visrut's user avatar
  • 137
3 votes
1 answer
132 views

Why does apropos and man -k omit or miss valid results?

For example, if I enter the following command: $ man -k compare The diff command is missing from the results, however the test command is not. I get the same results using apropos as expected. $ ...
metabind's user avatar
1 vote
2 answers
333 views

Find filenames difference between two directories (ignoring filename extension)

I have a lot of files that I need to keep in sync as example: ./regular/*.txt ./compressed/*.txt.bz2 When files get uploaded to ./regular I want to make a script to periodically check and bzip2 ...
luwu's user avatar
  • 13
-2 votes
1 answer
2k views

What is the difference between grep -r and find here?

I'm trying to recursively grep through files in a directory to find a certain string. The solution of my choice is: $ find . -type f -exec grep "string to find" {} \+ ... while using grep ...
Franz Wimmer's user avatar
24 votes
3 answers
8k views

Why is cp's option not to overwrite files called --no-clobber?

cp is a massively popular Linux tool maintained by the coreutils team of the GNU foundation. By default, files with the same name will be overwritten, if the user wants to change this behaviour they ...
TZubiri's user avatar
  • 393
2 votes
0 answers
45 views

ls output: group directory symlinks with directories [duplicate]

Using the --group-directories-first option I can group the ls output as follows: [a-z directories] [a-z files and symlinks] However, I would like symlinked directories to appear with the rest of the ...
JShorthouse's user avatar
0 votes
1 answer
395 views

GNU coreutils `sort` behave differently

I wanted to sort a list of data and I intended to sort it based on its first column which is an IP address. 192.168.1.100 192.168.1.101 192.168.1.110 192.168.1.119 192.168.1.20 192.168.1.30 192.168.1....
annahri's user avatar
  • 2,075
2 votes
1 answer
280 views

How can I find out more about the history of GNU coreutils commands?

Can I somehow find out more about the history of the development process of the GNU coreutils commands? For example, have su and runuser (which provide kind of similar functions, yet were decided to ...
finefoot's user avatar
  • 3,142
0 votes
1 answer
105 views

Why did GNU's expand convert a tab to less than 8 columns?

Using expand, I don't understand how many spaces it converts tabs to. From info expand: By default, expand converts all tabs to spaces. It preserves backspace characters in the output; they ...
SantaXL's user avatar
  • 365

1
2 3 4 5