Stack Exchange Network

Stack Exchange network consists of 174 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.

2
votes
1answer
29 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
29 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
89 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
98 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
62 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
33 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
37 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
41 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
28 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
69 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
41 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
33 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
27 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
40 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
81 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
57 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].....
1
vote
1answer
57 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
31 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
94 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
53 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
41 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
32 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
124 views

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

I have a script equijoin2: #! /bin/bash # default args ...
1
vote
1answer
85 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
57 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
291 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
191 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
673 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
355 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
67 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
48 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
112 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
37 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] ...
21
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
649 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
110 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
415 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
266 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/...
1
vote
2answers
47 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
280 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
219 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
136 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
867 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 ...
1
vote
1answer
866 views

Why does 'rmdir -p --ignore-fail-on-non-empty' fail when encountering $HOME?

Please consider the following commands: cd / mkdir -p ~/a/b touch ~/a/content # Removes dir 'b' and stops at 'a' because it's non-empty. # (This is the expected behavior.) rmdir -p --ignore-fail-on-...
2
votes
1answer
328 views

progress command doesn't show mv progress

I installed progress by brew install progress % progress -v progress version 0.13 And while I'm using mv command I used progress -w, but it failed with wrong permission error. progress -w No ...
1
vote
1answer
642 views

How do I interpret the output of dd when the option status=progress is chosen?

The dd manual page is very limited on this: ` status=LEVEL The LEVEL of information to print to stderr; 'none' suppresses everything but error messages, 'noxfer' ...
-3
votes
1answer
45 views

If there is no assignment of environment variable following `env`, what kind of environment is a command executed with?

env runs a command with a modified environment. env [option]... [name=value]... [command [args]...] If there is no name=value or option following env, what kind of environment is a command executed ...
2
votes
1answer
100 views

Coreutils realpath: confusing output when used with a hard (?) link

I was "playing around" and messed up my install of pip (Python package manager). Anyhow, it turns out, in my system /bin/pip is (?) a hard link of /usr/bin/pip (or the other way around, since I'm told ...
-1
votes
1answer
303 views

Erase files using the Gutmann method

How can I erase a file using the Gutmann method?