Questions tagged [coreutils]

GNU Core Utilities (coreutils) is a set of basic Unix command-line utilities

Filter by
Sorted by
Tagged with
0 votes
2 answers
674 views

GNU `find` error: "find: failed to read file names from file system at or below ‘/’ : No such file or directory"

OS: macOS Big Sur 11.6 I'm trying to find all files on my system that match a pattern so I can delete extraneous files after removing an application. For this purpose the application is RStudio. I'm ...
Leo's user avatar
  • 1
0 votes
1 answer
177 views

`openssl digest | head -c 10` gives strange results

I'm using salted hashes of some memorable words as login/pass for anonymous accounts and just now I've noticed that sometimes I get no result for my method and then I've discovered that it was not ...
dm33tri's user avatar
  • 23
1 vote
1 answer
925 views

How to split a file in specific size and pass that to the named pipe

I have a file of size 2GB and want to read that in chunks and pass each chunk to named pipe. Eg; mkfifo /tmp/pipe tail -c 200 myfile > /tmp/pipe & #last 200 bytes of file in the pipe. use the /...
Simplecode's user avatar
1 vote
1 answer
197 views

A command to sort stdin in ASCII order

Sometimes, GNU sort does not behave as expected. Here's an example: > bind | sort (This assumes you're using fish. In bash, the equivalent is bind -p.) All of the non-alpha characters in the ...
enigmaticPhysicist's user avatar
1 vote
1 answer
384 views

Cygwin inside Windows container, coreutils do not work in volumes

I set up Cygwin inside a Windows Docker container and some common operations just fail when executed in Docker volumes. Examples: $ mkdir foo bar $ mv foo bar mv: cannot move 'bar' to a subdirectory ...
cubanpit's user avatar
3 votes
1 answer
434 views

Obtain chunk size in split --filter commands?

I'd like to compress a partclone backup on the fly using zstd. Instead of writing one large zstd Frame, the archive should be split into small chunks that allow semi-random access. The latter requires ...
Wisperwind's user avatar
1 vote
0 answers
71 views

cp files from directories but abandon directory structure [closed]

As an example, I have this directory structure: src |- a \- 1 |- b \- 2 |- c \- 3 I want to copy 1, 2, 3 to something like this: dest |- 1 |- 2 |- 3 My idea is to write a bash script that ...
Takase's user avatar
  • 11
4 votes
0 answers
888 views

Is the shred utility effective when run in WSL2 for securely deleting files in windows NTFS partitions?

I want to securely delete a file in a Windows NTFS partition from WSL2 The file can be accessed in WSL from /mnt/c/path_to_file will using shred /mnt/c/path_to_file actually perform a secure erase ...
Albin K C's user avatar
2 votes
1 answer
258 views

Linux: how to move a large file tree, deleting files during the copy (not after)

I'd like to encrypt a disk in-place, from clear to ecryptfs (not boot disk, just disk with lots of data files). I've created the following structure: /mnt/ clear/ # the source files cipher/ #...
Yaniv Aknin's user avatar
1 vote
2 answers
856 views

GNU/Linux Date Command Ordinal Suffix

The PHP date function offers the ability to add an ordinal suffix for the day of the month, such as 'st', 'nd', 'rd', etc. Is it possible to achieve the same thing with the date command in Linux?
sebshady's user avatar
34 votes
1 answer
6k views

Why does the `ls` command sort files like this?

As I was trying to reverse engineer the ls command, I came upon an interesting behavior. When I make 3 files, foo.png, foopa.png, and fooqa.png, ls sorts them as foopa.png, foo.png, and fooqa.png. I ...
mooncat39's user avatar
  • 341
1 vote
1 answer
7k views

Using 'cut' command on Windows

I am trying to run this command line on Windows (I've installed GNU coreutils 8.24) echo android:versionCode="3267" | cut -d \" -f 2 Expected output: 3267 However, I am getting error: cut: the ...
Atul's user avatar
  • 143
31 votes
1 answer
30k views

Why does ls wrap some filenames in single quotes?

I've noticed that when I do ls in a terminal, some filenames are wrapped in single quotes and some aren't. I don't like the way this looks as I prefer my terminal outputs to be nice and uniform. ...
Hashim Aziz's user avatar
  • 12.7k
0 votes
2 answers
443 views

How to sort a list of numbers and null values in ascending order, with null values at the end?

I have a list of numbers and null values. How can I sort them in a way such that the null values come to the end of the list using sort in GNU coreutils? Sample Input (input.data) 0.9000 23 1 2 5 -...
Ishan Madhusanka's user avatar
1 vote
0 answers
6k views

ls command not working in the home directory

The ls command works fine for me in all other directories except my home directory, where I get the following error: * Exit with code 1, no result found, command line was:?? locate -b -i [\^g]*g[\^a]*...
rama's user avatar
  • 31
0 votes
2 answers
3k views

ls *.pdf complains: ls: invalid option -- '_'

I'm used to using 'ls' as I would in Linux Mint, e.g. 'ls *.pdf', but in this Debian variant 'ls .pdf' complains. I find myself using a length 'find -maxdepth 1 -type f -name ".pdf" -print' instead. ...
nate's user avatar
  • 173
4 votes
3 answers
2k views

How to compare two files and output lines which do not appear in the first?

If I have a file A containing a list of fields: 2017-04-23 2017-04-30 2017-05-07 2017-05-14 2017-05-21 2017-05-28 2017-06-04 2017-06-11 2017-06-18 2017-06-25 And another file B containing a list of ...
Zhro's user avatar
  • 867
0 votes
1 answer
74 views

df hide ifree etc (GNU)

(analogous to https://apple.stackexchange.com/questions/263437/df-hide-ifree-iused-512-blocks-customize-column-format-dont-show-inode-info for BSD) How can I hide the columns beginning with i (iused, ...
Sridhar Sarnobat's user avatar
4 votes
1 answer
2k views

Device names in MSYS2 dd

Which is the equivalent of: dd if=/dev/sda ... dd if=/dev/sda1 ... for dd.exe in MSYS2 in coreutils Does Chrysocome syntax apply?
antonio's user avatar
  • 937
-3 votes
1 answer
864 views

linux ls show seconds for recent files only

linux coreutils ls command shows when using with "-l" option timestamps including hours and minutes for recent files and shows year instead for files older than six months and newer than now. I would ...
user1850133's user avatar
0 votes
1 answer
937 views

Trying to install coreutils via MacPorts: "Error: Port coreutils not found"

I'm trying to use MacPorts to install coreutils. I check that MacPorts was installed correctly, $ port version Version: 2.3.4 and try to install coreutils, $ sudo port install coreutils Error: ...
NewNameStat's user avatar
1 vote
1 answer
166 views

Alternative to ls to group extensions before sorting

I'm looking for some way to modify/replace ls with a command that is capable of: Grouping directories first (as ls does) grouping files by user-defined extension groups (e.g., all image-type ...
MCor's user avatar
  • 11
2 votes
1 answer
3k views

Displaying unicode emoji in filenames on Ubuntu

I'd like to use emoji in filenames and access them on the command line, but I can't seem to get it to work with ls. Weird thing is, if I pipe into just about any other program, the emoji are correctly ...
Schlueter's user avatar
  • 259
18 votes
3 answers
13k views

more recent build of GNU coreutils for win32?

Is there a more recent build of unxutils.zip? (The unix command-line utilities for Windows) The canonical downloads are at http://unxutils.sourceforge.net/ but they date from 1999-2003; in particular ...
Jason S's user avatar
  • 7,665
4 votes
1 answer
2k views

In what order does GNU env print environment variables?

When invoked without arguments, the env and printenv commands from the GNU Coreutils print the value of every environment variable. What determines the order in which these variables are printed? It'...
Psychonaut's user avatar
2 votes
1 answer
93 views

How can I safely remove timeout from a script?

I started a script with timeout --signal 2 --kill-after 10 14400 and now decided that it should rather run as long as it must, so I need to remove that timeout from the running script. top -p $(...
Aich's user avatar
  • 133
4 votes
2 answers
2k views

find: missing argument to `-exec' when using + form of find

I want to execute a command on the paths found with the find command and I want to use + to reduce the number of times the external command is launched. Critically, the command has a fixed value ...
BeeOnRope's user avatar
  • 1,071
1 vote
1 answer
162 views

How to make sort consider blanks (GNU coreutils)

How can I make sort consider blanks? Original file: n c n b n a What I get with sort file is this: n a n b n c So how can I come to this order: n b n c n a Version: sort (GNU ...
murxo's user avatar
  • 28
0 votes
2 answers
538 views

GNU sort file names with prefix and one or two digit

I would like to use GNU sort to have the file names from a find command sorted by the numbers in the name. The name of the file is "cycle" then the first number to sort by, then ".subset", then the ...
719016's user avatar
  • 4,327
13 votes
2 answers
695 views

Can a file system's logical structure (including symlink targets) be represented in a single lightweight file (non-binary)?

After playing with multiple SQL and NoSQL databases over the years I feel the best way for me to ensure portability in my personal apps that are data-centric is to avoid all bonafide databases ...
Sridhar Sarnobat's user avatar
12 votes
4 answers
13k views

/usr/bin/realpath not found in Centos 6.5

I'm trying to type 'realpath' in CentOS 6.5. But it seems not installed. I checked it is contained in coreutils (archlinux). I double check the coreutils package which provide by CentOS, it lack the /...
Daniel YC Lin's user avatar
0 votes
2 answers
3k views

Unable to get ls to recognise LS_OPTIONS or LS_COLORS?

Trying to get --color=auto as the default ls argument. $ ls --version ls (GNU coreutils) 8.21 … $ echo $LS_COLORS no=00:fi=00:di=00;34:ln=01;36:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=...
A T's user avatar
  • 791
12 votes
3 answers
4k views

How does `wc -l` work?

I have to read a large file and before I start reading it, I need to know the total number of lines in the file (which are in millions). I have implemented a lot of solutions and have found one. But ...
detraveller's user avatar
11 votes
1 answer
8k views

`locate` wildcard strange behavior - why?

locate "*.png" returns all files ending with .png, as expected. locate "test.*" doesn't return anything, but there are files named test in my system. locate "*test" returns all files ending with ...
Vittorio Romeo's user avatar
3 votes
1 answer
324 views

What does GNU tar "--restrict" option actually restrict?

The manual of GNU tar only states that --restrict: --restrict disable use of some potentially harmful options Can anyone elaborate on what are these "harmful" options? I could not find ...
Francisco's user avatar
  • 2,278
34 votes
3 answers
11k views

Why is xargs necessary?

Suppose I want to remove all files in a directory except for one named "notes.txt". I would do this with the pipeline, ls | grep -v "notes.txt" | xargs rm. Why do I need xargs if the output of the ...
seewalker's user avatar
  • 713
0 votes
1 answer
72 views

Why does "head -3" give the same results as "head -n 3"?

I'm interested in why head works as it works with given parameters, i.e. head -3 produces the same output as head -n 3?
dhblah's user avatar
  • 153
11 votes
1 answer
11k views

Linux: ls -l prints only question marks:

I have a problem with listing of some directory with ls -l: $ ls -l ./directory -????????? ? ? ? ? ? file001.txt -????????? ? ? ? ? ? file002.txt and just ls works good: $ ls ....
osgx's user avatar
  • 6,787
1 vote
1 answer
191 views

Recursively searching for specific text inside specific files but only in specific folders

I have a nested folder structure containing lots of folders and files. How do I search inside files for a pattern eg "sampletext", but only if the filename matches a pattern (eg only search inside ...
jon's user avatar
  • 1,004
6 votes
4 answers
10k views

Where is the information retreived by "uname" stored?

Uname utility in *nix retrieves wonderful meta information about the machine. Where is this information stored?
kunj2aaan's user avatar
  • 181
0 votes
3 answers
2k views

df -h showing wrong output in GB

If I list df output for KB, MB and GB, they do not match e.g. $ df -k |grep xvdb /dev/xvdb1 12796048 732812 11413172 7% /xxx $ df -m |grep xvdb /dev/xvdb1 12497 ...
Anurag Uniyal's user avatar
19 votes
4 answers
42k views

Display filesystem's free space available to the root user

By default, Linux reserves some fraction of a filesystem for the root user, at least on ext4 (to prevent ordinary users from filling the drive completely and crashing the system, and to reduce ...
Mechanical snail's user avatar
0 votes
1 answer
556 views

gnu coreutils split verbose flushed?

When using the GNU coreutils split command with verbose mode, how can I make the lines that appear in the STDOUT be flushed with respect to the time when the file has finally been created? Fore ...
719016's user avatar
  • 4,327
1 vote
1 answer
580 views

using coreutils split file into pieces to different directories?

How can I use GNU's coreutils split command to split a large file into pieces of L number of lines each, but putting each of the different subfiles into different directories at the same time they are ...
719016's user avatar
  • 4,327
2 votes
1 answer
97 views

Prompt a user and wait for response

In GNUwin32 or UnxUtils, is there a way to prompt a user to "Press enter to continue" and wait for the enter key, such as the unix 'read' command. I used to have an old command 'ask' that would do ...
Bill's user avatar
  • 21
30 votes
2 answers
12k views

What is /usr/bin/[ and how do I use it?

I was looking at coreutils and found this as one of the files included as part of coreutils: /usr/bin/[. What is [ and what does it do? It is an executable. I just don't know what it does or how to ...
nelaaro's user avatar
  • 13.5k
5 votes
2 answers
6k views

How can I have ls follow the content of a directory like tail -f does on a file

I want to basically continuously update the file list of a directory similar to how tail does with the -f flag on a file. is there any reasonable way to do this?
loosecannon's user avatar
13 votes
1 answer
5k views

How can I install a more modern version of GNU utils (coreutils) on Debian Linux with no admin rights?

I would like to install a more modern version of GNU utils (coreutils) on a debian linux system where I have no admin rights. Is there a way to do that? The rationale is that I need a more modern ...
719016's user avatar
  • 4,327