3,158 reputation
1530
bio website None
location California, USA
age 54
visits member for 5 years, 5 months
seen Dec 20 at 8:47
Long-time Informix user and developer, experienced in C and Unix (many variants). Email: jonathan.leffler@gmail.com

Oct
24
comment confused about file owner in linux
Root is unfettered by such trivial details as 'does the user belong to the group'. At the o/s level, there is no such enforcement.
Oct
24
comment confused about file owner in linux
That's normally, but not necessarily, the case. It might be that the directory sets the group permission (SGID bit), while the user has write permission to the directory (perhaps public write permission, perish the thought, unless the directory has the sticky bit set; or perhaps because of ACLs). But in the normal case, a file is created belonging to the effective GID of the process that creates the file.
Oct
13
comment How to recover file from 'hidden' directory with Time Machine?
Thanks again for this answer — I needed to restore a .git directory and needed to use this again.
Sep
10
awarded  Cleanup
Sep
10
revised Running multiple operating systems on one laptop
rolled back to a previous revision
Jul
26
awarded  Notable Question
Jul
21
awarded  Yearling
Jun
18
comment How can I make `find` find files in reverse chronological order?
You can't make find do anything in a particular sorted order, beyond choosing between a depth-first search and a breadth-first search.
Jun
7
comment UNIX: Merging files with different extensions to one file
I could see it listing the message file before the XML file for each pair, but I really don't see how cat * could list all the XML files before all the message files. Can you elaborate on that? (Also, your cat command has no pipes whatsoever; it only uses I/O redirection.)
Jun
7
comment UNIX: Merging files with different extensions to one file
There's no reason why a shell programming question cannot be asked on SO.
Jun
2
comment How to compare files in different folders in Unix?
And the -b like the question?
May
25
comment Why can't I mv a file?
Be grateful you copied the trailing slash. Without that, you'd have had a file /Library/Receipt and the original version of the file /Library/Receipts/InstallHistory.plist, and that would lead to further confusion down the road. And let he who has never made a similar mistake cast the first stone — and when that stone is lobbed, I'll show you a rank novice programmer. Nevertheless, I don't think this Q&A is going to be a lot of help to future users.
May
25
answered Why can't I mv a file?
May
8
comment print specific line and then some more
Note that if the patterns appears in the next 10 lines, you should (probably) reset the 'print counter'. Or design it so that when you find the match, you set max_print = NR + 10; and then for each line, if (NR < max_print) print
May
6
comment quick tail on a huge file on linux
How long, roughly, is each line (or how big is the file in bytes)? Are the lines reasonably uniform in size, or are there short ones and long ones to worry about? If the standard tool won't do the job timely, then you will probably need to write your own. It is exasperating that you'll probably need to scan the tail end of the file at least twice, but probably unavoidable.
Mar
23
revised What does this mean? $ . test.sh
Clarify slightly
Mar
23
comment What does this mean? $ . test.sh
@chepner: That's entirely plausible. I haven't bothered to experiment with whether the current directory is searched first or last. For the most part, it is not important to this question, which is about the high-level difference between sourcing and executing a script. I agree, though, that it does matter if you're going to make a bullet-proof system depending on such a script.
Mar
23
answered What does this mean? $ . test.sh
Mar
23
comment What does this mean? $ . test.sh
The dot command pre-dates the source command by years. It was in the original Bourne shell. The C shell had the source command for the same job; bash imported that as a synonym for . some time later.
Mar
22
comment Rename a file based on the owner - linux/Unix
The + is useful when you want to provide a list of file names to a single invocation of the command. Here, though, you want to execute each mv with just two arguments (old name and new name), so you need to execute mv once for each file that's found. Or you use a more complex rename command, such as a Perl-based one that can do a regex mapping, so -exec rename 's/^/s/' {} + is now appropriate. (Beware: there are several sub-species of command called rename, and they're mostly feeble by comparison with the Perl-based one.)