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
0 votes
0 answers
17 views

Coreutils : "error: automatic de-ANSI-fication support has been removed"

I am trying to compile coreutils in my local but I am facing the following error: ... ./bootstrap: m4/wchar_t.m4 overrides ._bootmp2/m4/wchar_t.m4 ./bootstrap: m4/wint_t.m4 overrides ._bootmp2/m4/...
user avatar
1 vote
0 answers
20 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 ...
user avatar
  • 29
0 votes
0 answers
21 views

Is the source code for coreutils stored on my linux machine (as opposed to binaries)? Where? [duplicate]

Wanted to take a look at xargs source code and couldn't find it on my machine. Only binaries come up with which and whereis. Google a little bit and came across this great who's who list of unix ...
user avatar
  • 103
0 votes
3 answers
34 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 ...
user avatar
  • 366
1 vote
1 answer
26 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 ...
user avatar
  • 2,281
9 votes
3 answers
1k 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 ...
user avatar
  • 113
1 vote
3 answers
69 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 ...
user avatar
1 vote
1 answer
48 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 ...
user avatar
  • 497
0 votes
1 answer
56 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 ...
user avatar
0 votes
3 answers
179 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 ...
user avatar
  • 3
0 votes
1 answer
97 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 ...
user avatar
  • 207
2 votes
1 answer
119 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 <...
user avatar
  • 123
-1 votes
1 answer
62 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....
user avatar
2 votes
0 answers
74 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 ...
user avatar
0 votes
1 answer
87 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 ...
user avatar
0 votes
0 answers
78 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 ...
user avatar
-1 votes
2 answers
389 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 ...
user avatar
2 votes
0 answers
110 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] ...
user avatar
1 vote
1 answer
143 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 --...
user avatar
  • 1,287
0 votes
4 answers
289 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 ...
user avatar
  • 1
1 vote
2 answers
130 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
23 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 ...
user avatar
  • 3
1 vote
1 answer
378 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="...
user avatar
  • 551
1 vote
0 answers
45 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 ...
user avatar
  • 3,620
2 votes
1 answer
206 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 ...
user avatar
  • 121
0 votes
0 answers
36 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 ? ...
user avatar
  • 13
3 votes
1 answer
56 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. $ ...
user avatar
1 vote
2 answers
127 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 ...
user avatar
  • 13
-1 votes
1 answer
688 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 ...
user avatar
23 votes
3 answers
5k 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 ...
user avatar
  • 391
2 votes
0 answers
44 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 ...
user avatar
0 votes
1 answer
205 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....
user avatar
  • 1,580
2 votes
1 answer
186 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 ...
user avatar
  • 1,964
0 votes
1 answer
74 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 ...
user avatar
  • 345
12 votes
2 answers
1k views

Explanation of tac --before

-b, --before The separator is attached to the beginning of the record that it precedes in the file. And I can't understand the following output: $ echo -e "Hello\nNew\nWorld\n!" > file $ ...
user avatar
  • 345
2 votes
1 answer
2k views

Why is mktemp -u considered "unsafe"?

I read the --help text for mktemp recently (the man page wasn't available) and came upon this: -u, --dry-run do not create anything; merely print a name (unsafe) Why is this "unsafe"? Is ...
user avatar
  • 403
15 votes
5 answers
3k views

How to run a command 1 out of N times in Bash

I want a way to run a command randomly, say 1 out of 10 times. Is there a builtin or GNU coreutil to do this, ideally something like: chance 10 && do_stuff where do_stuff is only executed 1 ...
user avatar
  • 329
1 vote
1 answer
478 views

What is the use of n option in cut command?

I'm learning about the cut command. In the man page of cut, they show the -n option like: -n (ignored) But I didn't understand the usage of the n option or when we would use it. Can anyone ...
user avatar
  • 113
4 votes
1 answer
82 views

Why does ls sort results the way it does? [duplicate]

I'm just wondering why ls output is sorted the way it is: $ mkdir SortTest<br> $ cd SortTest<br> $ for a in {1..34}; do touch filename_$a.txt; done $ ls -l -rw-r--r-- 1 user user 0 Jun 28 ...
user avatar
  • 51
1 vote
1 answer
423 views

Translating Linux stat(1) command into BSD stat(1) command

Background CLion's remote project feature currently doesn't support FreeBSD as a remote host OS, but I want to do some hacking and see if it works. By reading the log file, I think I have spotted (...
user avatar
  • 287
0 votes
0 answers
54 views

Filter out items that belong to the Source Packages

Here I have a Manifest of Ubuntu I would like to list out only the Source Packages and not the containing items. binutils 2.31.1-6ubuntu1 binutils-common:amd64 2.31.1-6ubuntu1 binutils-x86-64-...
user avatar
4 votes
1 answer
5k views

When does `mv` change the timestamp of a file and while does it not?

Moving directory without modifying timestamp says that mv changes the timestamp of a directory. When I mv a file from an external hard drive to another external hard drive, it also changes the ...
user avatar
  • 89.8k
-2 votes
1 answer
335 views

Does mv not remove transferred files from source while other files are still in transfer?

I am moving 100G files from an external hard drive to another external hard drive, mv /external/hdd1/sourcedir /external/hdd2/destdir While it is in process, I found that the files copied to the ...
user avatar
  • 89.8k
2 votes
2 answers
945 views

Does the size of the random_source file matter?

Some GNU coreutils utilities like sort and shuf use a file as what effectively serves a seed. Does the size of the file matter? The recommended way, https://www.gnu.org/software/coreutils/manual/...
user avatar
  • 501
1 vote
1 answer
174 views

Is there a fast tool to show all the unique unicode characters in a file and their count?

Does anybody know a tool to tabulate all the unique unicode characters and their counts in a file?
user avatar
9 votes
2 answers
2k views

How to find a partial directory path?

Suppose I don't know where my Django source is stored, but I know that it contains these directories in this way: django/contrib/admin. How can I use the find command or any more appropriate ...
user avatar
  • 256
6 votes
2 answers
244 views

Why does GNU Core Utilities stat (including du and ls) report the following sizes (ext4 in GNU/Linux)?

If I have the following contents in a directory: empty_dir: Empty directory. empty_file: Empty file. one_char: File consisting of one character. several_blocks: File consisting of several blocks (but ...
user avatar
  • 244
1 vote
1 answer
926 views

Awk doesn't exit despite "exit 0" command

I have the following command: sudo docker logs -f <id> | awk '/Listening on / {print $3; exit 0;}' From what I understand, awk should find the first line that matches the pattern, print the ...
user avatar
  • 495
3 votes
1 answer
136 views

Should I never use stdbuf's fully buffered mode?

On my system (a recently updated Arch Linux), the manpage for stdbuf has the following in the "BUGS" section: On GLIBC platforms, specifying a buffer size, i.e., using fully buffered mode will ...
user avatar
  • 132
1 vote
2 answers
978 views

What is a good command for moving a directory containing relative symbolic links to files outside the directory?

I like to use relative symlinks when possible because they stay valid even when my filesystem is mounted in a non-root location, for example if I am accessing it remotely. However, if I move a ...
user avatar

1
2 3 4 5