Questions tagged [coreutils]

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

Filter by
Sorted by
Tagged with
1
vote
0answers
14 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 ...
0
votes
0answers
24 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 ...
2
votes
1answer
152 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/ #...
1
vote
1answer
119 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?
33
votes
1answer
5k 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 ...
1
vote
1answer
2k 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 ...
13
votes
1answer
5k 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. ...
0
votes
2answers
119 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 -...
1
vote
0answers
4k 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]*...
0
votes
2answers
1k 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. ...
4
votes
3answers
88 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 ...
0
votes
1answer
48 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, ...
4
votes
1answer
704 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?
-3
votes
1answer
178 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 ...
0
votes
1answer
705 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: ...
1
vote
1answer
107 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 ...
2
votes
1answer
1k 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 ...
10
votes
2answers
6k 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 ...
2
votes
1answer
711 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'...
2
votes
1answer
46 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 $(...
3
votes
2answers
791 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 ...
1
vote
1answer
71 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 ...
0
votes
2answers
167 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 ...
13
votes
2answers
593 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 ...
10
votes
3answers
9k 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 /...
0
votes
2answers
2k 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=...
11
votes
3answers
3k 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 ...
9
votes
1answer
6k 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 ...
2
votes
1answer
176 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 ...
27
votes
2answers
8k 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 ...
0
votes
1answer
57 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?
11
votes
1answer
10k 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 ....
1
vote
1answer
175 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 ...
5
votes
4answers
7k 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?
0
votes
3answers
1k 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 ...
12
votes
3answers
27k 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 ...
0
votes
1answer
429 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 ...
1
vote
1answer
483 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 ...
2
votes
1answer
91 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 ...
26
votes
2answers
8k 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 ...
1
vote
2answers
3k 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?
13
votes
1answer
4k 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 ...