The tag has no wiki summary.

learn more… | top users | synonyms

1
vote
1answer
41 views

Difference between / and // [duplicate]

On the bash prompt one, three or more slashes (/,///,////, ...) are treated as a single slash, whereas two slashes (//) are left as is: 12:07 $ cd / 12:07 $ pwd / 12:07 $ cd // 12:07 $ pwd // 12:07 $ ...
16
votes
3answers
1k views

Why is coreutils sort slower than Python?

I wrote the following script to test the speed of Python's sort functionality: from sys import stdin, stdout lines = list(stdin) lines.sort() stdout.writelines(lines) I then compared this to the ...
0
votes
0answers
20 views

Set default editor for 'info coreutils' [duplicate]

I'm using Ubuntu 14.04 and have this in my .bash_profile: export EDITOR=/usr/bin/vim export VISUAL=/usr/bin/vim man respects this setting but info always opens in something else, nano or it's own ...
0
votes
1answer
44 views

Why can't my `date` deal with timezones? [duplicate]

I'm having some weird issues with GNU coreutils date v8.4 (CentOS) that aren't occurring in v8.21 (Ubuntu/Mint). On v8.4, I get the following output (I'm in PST): $ date --version | head -n 1 date ...
2
votes
1answer
32 views

Problem with install command to copy a whole directory

So I have a repo with some of my config files and I'm trying to create a makefile to install them in the homedir. The problem I have is that when I run the following command straight in bash install ...
0
votes
2answers
112 views

Permissions for installing coreutils with pkgsrc on NetBSD

I'm trying to install coreutils on NetBSD 6.1.5 using the pkgsrc system. This is on the default install of 6.1.5. The only change made has been to install zsh and set it as my default shell for users ...
2
votes
1answer
43 views

Where is using @ before a date string for seconds since the epoch documented?

GNU date and touch commands (and presumably others) use @date to define a date string as seconds since the epoch. For example: $ TZ=UTC date -d@10 Thu Jan 1 00:00:10 UTC 1970 I was answering a ...
2
votes
3answers
284 views

When was a file last opened?

How do I determine, when a file was last opened? I've looked at man ls (using GNU coreutils 8.22) and I don't see anything about this timestamp.
8
votes
2answers
360 views

sort by hex value

Using coreutils sort, how can I sort numerically by a hexadecimal value (field)? I was expecting something along the lines of sort -k3,3x file_to_sort however, such an x does not exist. Edit: ...
0
votes
2answers
38 views

Where can I view a changelog for the sort command

I need to find sort's version when the -V flag was introduced. But I am finding myself some hard time finding the changelog for this command. Where can I view it?
1
vote
2answers
51 views

numfmt invalid suffix input

I am using numfmt to convert a remote file's Content-Length from bytes to IEC format, i.e. 21M $ curl -sI http://jruby.org.s3.amazonaws.com/downloads/1.7.12/jruby-bin-1.7.12.tar.gz|grep Length|cut ...
1
vote
1answer
51 views

“install” command as script

I'm working on a heavily modified Linux based OS targeted for a really specific environment - easy-to-use NAS systems. It does not provide any GUI, apart from a web interface, but it at least has SSH. ...
7
votes
2answers
441 views

How is the order in which tar works on files determined?

$ touch dir/{{1..8},{a..p}} $ tar cJvf file.tar.xz dir/ dir/ dir/o dir/k dir/b dir/3 dir/1 dir/i dir/7 dir/4 dir/e dir/a dir/g dir/2 dir/d dir/5 dir/8 dir/c dir/n dir/f dir/h dir/6 dir/l dir/m dir/j ...
27
votes
3answers
2k views

What is the `[` program that resides in my system's /bin?

I was recently browsing my Fedora's /bin folder and noticed a binary named [. I did try to search the internet for more information on that, but I couldn't find anything useful. Running it through ...
4
votes
2answers
379 views

What does `du - hb` do?

With du -bh I think I get the apparent size in human readable format: # du -bh 295K ./test However, I would expect the same from du -hb, but I get something else: # du -hb 301926 ./test I ...
4
votes
2answers
2k views

Why is dd using direct slower writing to disk than to a file

I am trying to compare aggregate write rates when writing to a file in a GPFS file system, as compared to writing directly to a disk on a system with Red Hat Enterprise Linux Server release 6.4 ...
1
vote
1answer
57 views

Memory-efficient utility to return N first sorted values

I would like to implement a very popular MapReduce example using only existing programs operating in a UNIX way. The problem is to find N most frequent values in an enormous amount of data. The ...
4
votes
2answers
75 views

Off by 1 year error in GNU date?

Right now, 2014-01-06, GNU date 8.4 on CentOS release 6.4, does this: $ date --date "last week" +"%Y-%V" 2013-01 On the other hand, $ date --date "last week" +"%Y-%U" 2013-52 which is just ...
0
votes
2answers
185 views

How can I format the output of stat to contain the null character?

I want to delimit file paths by using the null character (NUL, \0, ...) just like for example find -print0 does. I'm using bash and I tried the following without success: find $1 -print0 > ...
0
votes
1answer
158 views

what does the following command do?

what does the following command do? I have tried to study the linux command but I could not find out what this command does. here is the command: touch finger ; finger touch
2
votes
3answers
3k views

cp --no-target-directory explained

Question: I need a simple example of how to use cp --no-target-directory. I do experience some difficulties in understanding cp --no-target-directory. I do understand the explanation for mv ...
3
votes
2answers
948 views

cp -L vs. cp -H

Problem When copying files with cp -H or cp -L, I get the same results: $ ls -l fileA fileA -> fileB $ cp fileA somewhere/ -H $ ls -l somewhere/ fileA # fileA is a copy of fileB, only ...
2
votes
1answer
49 views

Checking the order of items in a shell environment variable

I am wanting to check that a certain directories always appear after other directories in an environment variable. List items are separated by a colon, as with the PATH variable. This is not simply ...
4
votes
3answers
3k views

convert soft- to hardlinks with cp

The cp command's infopage offers on the option --preserve= the following: links Preserve in the destination files any links between corresponding source files. Note that with -L' ...
3
votes
1answer
198 views

cp --attributes-only documented but not working “now”?

PROBLEM: cp --attributes-only Source Target results in two files unchanged, where the attributes from Source should be copied to Target. Attempts to solve: As I have the 8.13 version of coreutils ...
10
votes
2answers
475 views

/usr/bin/ptx: Can you provide a use case or two?

I was going through the list of files included in coreutils and I was able to come up with an example of how I could personally use all of the commands provided except for ptx. Can you give one or two ...
7
votes
4answers
5k views

Mac OS X: dircolors not found?

I just switched to a Macbook Air. I installed zsh using homebrew, but when I use some of the code that I (originally had) in my .zshrc, I get an error saying that .dircolors was not found. Below is ...
5
votes
3answers
244 views

What's the real point of the -f option on rm?

By reading the GNU coreutils man page for rm, one of the options is -f, which according to the manual, -f, --force ignore nonexistent files and arguments, never prompt Now, I made some ...
3
votes
1answer
5k views

Command to transpose (swap rows and columns of) a text file [duplicate]

Is there currently a generic command that will "pivot" input. e.g. #labeled.file name: bob title: code monkey name: joe title: pointy haired is converted to: name title bob code monkey joe ...
3
votes
2answers
374 views

See extended attributes with coreutils ls on Mac

I have coreutils installed via MacPorts on my Mac running OS X 10.8.4. I have ls set to use the coreutils version of ls [(GNU coreutils) 8.21] when available: if [ -e /opt/local/libexec/gnubin ]; ...
3
votes
2answers
121 views

Ignore blank keys in coreutils sort

How do you ignore or is there a way to change the sort order of empty keys when using sort -k? # cat afile a b 11 20 93 45 55 26 09 31 How can I sort the empty column b values at the bottom so it ...
1
vote
2answers
84 views

Checking compatibility between core utils and older GNU/Linux systems

I have non-root access to a grid of computers. The installed OS is the following: $ uname -mrs Linux 2.6.18-274.el5xen x86_64 $ cat /etc/*-release ...
1
vote
2answers
181 views

Is grep part of coreutils? (If not, why?)

I have read in a few websites that grep comes with coreutils (e.g. https://wiki.archlinux.org/index.php/Core_Utilities) However, after building them, I noticed that grep is missing. I wonder if I ...
4
votes
1answer
121 views

Behavior of `du` command with `-L` flag

I've noticed a strange behavior with du command when it's used with -L command line option. I'm using Slackware 14 and Coreutils 8.19. To reproduce the strange behavior, create two folders: mkdir ...
3
votes
1answer
106 views

Print arguments to printf in no particular order

How can I refer back to arguments to coreutil's printf in no particular order? This is what I want to avoid: $ printf '%s %s %s %s %s %s %s' a c a c b c a a c a c b c a This is what I would like ...
9
votes
4answers
1k views

Why is cp --reflink=auto not the default behaviour?

Why is cp --reflink=auto not the default behaviour? Could it cause any harm to enable it? Is it possible to enable it at compile time, so it is used all across the system, not just in interactive ...
1
vote
3answers
3k views

ls command - define number of columns

Is there a way to define the number of columns in ls output? I got this far: ls -C sorts in columns and ls -1 produces one column. --tabsize = option to produce two columns resulted in what looks ...
9
votes
3answers
5k views

How can I display octal notation of permissions with ls - and can octal represent all permissions? [duplicate]

After looking at the man page for ls on my system and searching Google, I see there IS a hack of way to use awk or perl to show octal permissions when using ls, but with bash is there anything more ...
4
votes
1answer
89 views

How does coreutil's date manage to get such weird results?

I was playing around with date to try to convert expressions such as "2 hours" to a number of seconds like 7200. I thought I could perform this with invocations such as: date -d "1970-01-01 00:00:00 ...
4
votes
2answers
269 views

tac command's option creates strange output [comprehension question]

Say I have this file, containing nothing but a b c b a Using tac --separator=a file in BASH [on a Debian based Linux], I get this: # empty line # empty line b c ...
7
votes
1answer
99 views

Is there a way to express: `--link` or fall back to ordinary copy in cp (from GNU coreutils)?

Is there a way to tell cp to --link (i.e. create hard links), but fall back in the case where I am attempting inter-device hardlinks? Inter-device links aren't possible and would cause cp to fail. ...
4
votes
4answers
2k views

Make cp return an error value if the target exists

Is there a way to make cp (from GNU coreutils on Linux) return a nonzero value in case the target file does already exist? Or is there any other small utility which is commonly available and which ...
4
votes
1answer
717 views

Install only a few GNU coreutils?

Is there a way to build and install only a few of the GNU coreutils? The README in coreutils-8.19.tar.xz lists 100-odd, but the INSTALL doesn't say how to install only a few, and the Makefile is (to ...
4
votes
4answers
606 views

Is there a practical use for the GNU factor command?

Looking through the GNU Coreutils, I spotted the factor command, that I had never noticed before. Reading the man page: Print the prime factors of each specified integer NUMBER. If none are ...
2
votes
3answers
483 views

When the lines of a file or directory get too long, upgrade to ls list format?

Is there a way I can do this? For example if a gets a long name like: i-have-names-that-are-too-long-to-describe/ i-have-names-that-are-too-long-to-describe-2/ ...
8
votes
2answers
779 views

What is the point of ls -f (or, why is this hanging?)

I've got a directory with about 100,000 files in it. ls -f hangs for over a minute. I ran strace, and immediately started seeing getdents, so ls is clearly reading the directory. I also see a lot ...
4
votes
2answers
1k views

Trailing slashes on symbolic links to directories

I'm trying to emulate the process of path resolution (see man page path_resolution) in unix-like systems. My OS is Linux with GNU coreutils 8.7. In order to clarify the meaning of extra trailing '/' ...
12
votes
2answers
260 views

`test` and `[` - different binaries, any difference?

I noticed while answering another question that test and [ are different binaries, but the [ manpage pulls up test's. Besides the requirement for an ending ], is there any difference? If not, why are ...
2
votes
1answer
541 views

Why does unlink(1) support only one file?

I'm used to commands supporting multiple filename arguments if possible, but unlink doesn't: %> unlink a b unlink: extra operand `b' Try `unlink --help' for more information. I ended up using a ...
29
votes
10answers
16k views

Correct locking in shell scripts?

Sometimes you have to make sure that only one instance of a shell script is running at the same time. For example a cron job which is executed via crond that does not provide locking on its own (e.g. ...