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

learn more… | top users | synonyms

23
votes
2answers
3k 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 ...
12
votes
2answers
414 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
1answer
3k 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 ...
8
votes
3answers
681 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 ...
8
votes
2answers
2k 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 ...
8
votes
1answer
7k 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 ...
6
votes
2answers
9k 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 ...
4
votes
4answers
3k 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?
3
votes
1answer
1k 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
3answers
2k 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 /...
2
votes
1answer
160 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 ...
2
votes
1answer
22 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 $(...
2
votes
1answer
77 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 ...
1
vote
1answer
66 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 ...
1
vote
1answer
88 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'...
1
vote
1answer
155 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 ...
1
vote
1answer
24 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 ...
1
vote
1answer
35 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 ...
1
vote
1answer
277 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 ...
0
votes
2answers
675 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?
0
votes
1answer
38 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?
0
votes
3answers
707 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 ...
0
votes
2answers
63 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 ...
0
votes
2answers
831 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=...
0
votes
1answer
315 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 ...
0
votes
1answer
35 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: ...
0
votes
1answer
54 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 ...
0
votes
1answer
271 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 ...
-3
votes
1answer
25 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 ...