Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

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.

1
vote
2answers
9 views

Why does `find -print0` still escape newlines?

I'm confused by this experiment (in Bash): $ mkdir 'foo\n' $ find . -print0 | od -c 0000000 . \0 . / f o o \ n \0 0000012 As you can see, "find" is correctly delimiting the output ...
1
vote
1answer
30 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/...
1
vote
1answer
39 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?
4
votes
2answers
181 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 ...
6
votes
2answers
110 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 ...
0
votes
1answer
65 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 ...
2
votes
1answer
40 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 ...
0
votes
1answer
53 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 ...
2
votes
1answer
91 views

If a string has a blank within it, can I still use tsort on the string?

coreutils manual says tsort reads its input as pairs of strings, separated by blanks, indicating a partial ordering. If a string has a blank within it, according to the manual, I can't use tsort ...
2
votes
2answers
112 views

tsort: -: input contains an odd number of tokens

coreutils manual says tsort reads its input as pairs of strings, separated by blanks, indicating a partial ordering. The output is a total ordering that corresponds to the given partial ...
-3
votes
1answer
66 views

How does `cat` work so that it allows reading a file line as an array element? [duplicate]

In bash, we can read an file into an array, so that each line in the file becomes an element of the array. $ arr=( $(cat myfile) ) I was wonder how cat works so that it allows reading a file line as ...
-2
votes
1answer
45 views

how can I provide files as inputs to `tsort`? [closed]

The input to tsort can be provided as in this example: $ tsort <<EOF a b c b c d e EOF If I have two files as inputs instead, a b c and b c d e how can I provide the two files in bash as ...
0
votes
1answer
41 views

Can I merge-sort two sorted files by using comm?

comm assumes its two inputs are sorted. Is it correct that it works in the same way as the merge sort algorithm? If yes, can I use comm to merge-sort two sorted files? Thanks.
0
votes
2answers
42 views

Is it correct that `od` can't show binary number?

Is it correct that od can't show binary number? I can't find an argument to provided to its -t option for showing binary number. I feel it is natural to expect od to show binary number, or do I miss ...
0
votes
1answer
29 views

Is the an elegant way to select rows in a file where a given column has a given value?

I have a file with a lot of lines like this 0 file:/home/knappen/somefilename.txt 7 0.2838356973995272 19 0.21823286052009455 18 0.10121158392434988 15 0....
3
votes
1answer
103 views

Alternatives of ls: dir and vdir [duplicate]

When I check the coreutils, I found that GNU Coreutils 10 Directory listing This chapter describes the ls command and its variants dir and vdir, which list information about files. • ls invocation: ...
-1
votes
1answer
47 views

Refer to gnu-manual page from bash

I installed the latest GNU/Bash and gnu coreutils on Mac $ bash --version GNU bash, version 4.4.23(1)-release (x86_64-apple-darwin18.0.0) check the coreutils with a g prefix $ gls -l $(which gls) ...
0
votes
1answer
39 views

`--prefix=/`,`--program-prefix=g` and `--without-gmp` mean

When I install the coreutils, I found that ./configure --prefix=/usr/local/Cellar/coreutils/8.30 --program-prefix=g --without-gmp What does the --prefix=/, --program-prefix=g and --without-gmp mean?
0
votes
1answer
31 views

What is the difference between calling “id -G” and “id -G -r”?

I know the -r flag should print the real group the user is in. But since -G already prints all his groups, does this make a difference? What does id -gr xxxsome_user really print out? How can a user ...
0
votes
1answer
44 views

GNU coreutils need suggestions [closed]

Can anyone please suggest me some book or website from where I can learn about gnu coreutils to get more knowledge about terminal commands. An interactive book or website would be a nice start.
0
votes
1answer
105 views

how to use find + xargs to make symlinks to selected files while keeping relative directory tree (uses gnu cp -s)

I'm trying to replicate select files from a directory structure as symlinks in a duplicate directory, eg from a directory structure such as this: ../1/a/data1.txt ../1/a/file1.txt ../1/a/b/file2.txt ...
3
votes
1answer
65 views

How can I execute an equivalent of `head -z` when I don't have the `-z` option available?

I need head -z for a script (off-topic, but the motivation can be found in this question), but in my CoreOS 835.13.0 I get head: invalid option -- 'z'. Full head --help output: Usage: head [OPTION].....
2
votes
1answer
85 views

“stat -f” says “Type: fuseblk”. It should be “Type: fuse”

If I run stat -f . on a bindfs or sshfs filesystem, it shows "Type: fuseblk". This is not right. Unlike ntfs-3g, these filesystems are not implemented using a block device. If I run findmnt, it ...
0
votes
0answers
33 views

Can coreutils' `pr` do what util-linux's `column` can do?

Can coreutils' pr do what util-linux's column can do: The column utility formats its input into multiple columns. The util support three modes: columns are filled before rows ...
0
votes
1answer
143 views

What does `pr -e` mean?

From coreutils' manual about pr: ‘-e[in-tabchar[in-tabwidth]]’ ‘--expand-tabs[=in-tabchar[in-tabwidth]]’ Expand tabs to spaces on input. Optional argument in-tabchar is the input tab ...
-3
votes
1answer
57 views

What is `${1- hour}`? [duplicate]

From https://stackoverflow.com/a/27595805/156458 date -d "next ${1- hour}" '+%H:00:00' What is ${1- hour}? Is it some shell parameter expansion, or input format of date and time? Why does ${1 ...
0
votes
1answer
42 views

What does `sleep` with multiple arguments mean?

I was wondering what differences are between sleep 1 2 3 and sleep 6 ? They seem the same. Thanks.
0
votes
1answer
41 views

What happens if I specify nonexisting join field(s) for one or both of the input files?

I have two files $ cat file1 c c1 b b1 $ cat file2 a a2 c c2 b b2 What happens if I specify nonexisting join field(s) for one or both of the input files? Why do the following outer joins generate ...
1
vote
1answer
144 views

Why do I have “join: extra operand '/dev/fd/62'” error?

I have a script equijoin2: #! /bin/bash # default args ...
1
vote
1answer
99 views

What does `join -e` mean?

From coreutils' manual about join -e string Replace those output fields that are missing in the input with string. I.e., missing fields specified with the -12jo options. I don't understand ...
-1
votes
1answer
59 views

What does `join` do in terms of equijoin in SQL or operations in relational algebra?

join in coreutils reminds me of equijoin in SQL. join writes to standard output a line for each pair of input lines that have identical join fields. I am not very clear about what join does from ...
1
vote
2answers
298 views

What does `-dD` mean to `uniq`?

From https://unix.stackexchange.com/a/277707/674 find . ! -empty -type f -exec md5sum {} + | sort | uniq -w32 -dD can find duplicate files under the current directory. What does -dD mean to uniq? I ...
1
vote
2answers
303 views

`stat` output format: truncate a date field

In a stat format (at least the one I get from bash on Linux) one can use format modifiers: for instance %010s will force a size field to be at least 10 characters, padded to the left with zeroes (btw ...
0
votes
1answer
17 views

What does the “MISSING” directive mean in a dircolors file?

I ran dircolors --print-database to show the default dircolors configuration and it included these lines (reformatted for clarity): # symlink to nonexistent file, or non-stat'able file ... ORPHAN 40;...
5
votes
2answers
1k views

Why do df and df -h show different value? How does df -h perform calculation?

how exactly df -h works? If I run df, I get this: Filesystem 1K-blocks Used Available Use% Mounted on /dev/simfs 41943040 7659828 34283212 19% / If I run df -h, I get this: Filesystem ...
1
vote
0answers
546 views

logname: no login name

I am trying to understand the differences between logname and LOGNAME from Difference between logname and $LOGNAME and https://askubuntu.com/questions/490620/difference-between-logname-and-logname On ...
1
vote
1answer
77 views

What is the closest for `cp` to `rsync -a`?

From manpage of rsync, -a, --archive This is equivalent to -rlptgoD. It is a quick way of saying you want recursion and want to preserve almost everything (with -H being a notable omission)...
1
vote
2answers
49 views

Why do du/df and by System Monitor show used space in home differently? [duplicate]

$ sudo du -h -d 0 home/ 309G home/ $ df -h Filesystem Size Used Avail Use% Mounted on ... /dev/sda4 550G 309G 214G 60% /home ... System Monitor on Ubuntu shows the used space on /...
0
votes
1answer
196 views

Why has the --group-directories-first switch for the ls command never evolved to have a short form as well?

This has long puzzled me and this seemed like the best venue to solicit the perspective of those with far more POSIX time-in-grade than I have. I consider the parsing of ls output in this manner to be ...
0
votes
1answer
45 views

Coreutils (or otherwise) `ls`: don't append symbol indicating type when piped

Is there a way to get GNU coreutils ls (or any other open-source ls) to omit the trailing symbol (* for executable, / for directory, etc.) only when output is piped? the GNU ls has a --color[=WHEN] ...
22
votes
2answers
2k views

md5sum prepends '\' to the checksum

Why md5sum is prepending "\" in front of the checksum when finding the checksum of a file with "\" in the name? $ md5sum /tmp/test\\test \d41d8cd98f00b204e9800998ecf8427e /tmp/test\\test The same ...
1
vote
1answer
899 views

How to convert file dates to a particular format when using 'ls'

I have the following input data: -rw-rw-r--. 1 abmnyu abmnyu 0 Dec 30 07:06 ffd_in_imp_bus.dat -rw-rw-r--. 1 abmnyu abmnyu 0 Dec 30 07:06 ffd_ik_imp_bus.dat I need Dec 30 to be displayed in the ...
4
votes
2answers
117 views

Understanding fmt (gnu coreutils)

I'm using fmt (GNU coreutils) 8.25 and I fail to understand how to use it. In particular, I don't understand the following results. $ echo -n "a b c d e" | fmt -w3 -g3 I expected to obtain a b c d ...
0
votes
1answer
533 views

Using install -D in Makefile

I'm trying to edit a Makefile that contains: ... install -d $(DESTDIR)/usr/lib/myApp install -d $(DESTDIR)/usr/lib/myApp/scripts install -t $(DESTDIR)/usr/lib/myApp/scripts \ src/scripts/ap.sh \ ...
2
votes
1answer
313 views

GNU install -d recursive?

I have 3 commands to create the folders necessary in a Makefile: install -d $(DESTDIR)/usr/lib/app install -d $(DESTDIR)/usr/lib/app/scripts install -d $(DESTDIR)/usr/lib/app/scripts/...
0
votes
2answers
57 views

Retrieve first hour in daylight savings change - GNU date

Last weekend most of Western Europe shifted back one hour - there were two instances of 2017-10-29T02:00. To translate the time into UTC I can use GNU date: $ date -d 'TZ="Europe/Rome" 2017-10-29 ...
0
votes
1answer
308 views

df from busybox shows different number of inodes than that of tune2fs

we have Beaglebone black based custom board, we have busybox shell including coreutils. busybox version is BusyBox v1.20.2 (2017-10-16 16:39:36 EDT) now we wanted to check the inode usage in each ...
0
votes
1answer
267 views

Finding out coreutils incompatibilities between Alpine and “normal” Linux (eg. Ubuntu)

I've fighted with non-working gitlab build. I've needed to sanitize output of psql by removing some non-printables, I've found out the command: <psql invoke> | tr -cd [:print:] Happily ...
1
vote
1answer
163 views

What size blocks does `truncate --io-blocks` use?

What size blocks does GNU truncate --io-blocks use? -o, --io-blocks treat SIZE as number of IO blocks instead of bytes 512 bytes blockdev --getbsz blockdev --getpbsz
9
votes
1answer
1k views

Are there any disadvantages of `cp --sparse=always`?

Is there any reason not to use use --sparse=always with every invocation to cp? info cp says: ‘--sparse=WHEN’ A “sparse file” contains “holes”—a sequence of zero bytes that does not occupy ...