3,058 reputation
1529
bio website None
location United States
age 53
visits member for 5 years
seen Jul 30 at 3:49
Long-time Informix user and developer, experienced in C and Unix (many variants). Email: jonathan.leffler@gmail.com

Oct
17
comment How to do custom sorting using unix sort?
For these three values, you want reverse alphabetic order. For the general case, you'll need to map the names to a sort order number, and then do the sorting using the sort order number. Or go for a scripting language... One possibility is the join command, but you could end up with a lot of sorting — the input files for join must be sorted in one order, and then you'd be using sort again to put the data into a different order (and losing the sort order column as a post-sort step).
Sep
14
comment linux sort -n uniq -c
What are 'the unique appearances'? One instance of each word that appears? Or one instance (the only instance) of each word that appears only once? Please clarify by editing the question. (Incidentally, it's awfully tempting to say that the fastest way to cat the file is to use cat file.)
Sep
14
comment linux sort -n uniq -c
@squiguy: the file must be sorted before uniq works sanely. The input clearly isn't sorted.
Sep
14
comment linux sort -n uniq -c
@Clustermagnet: UUOC Award? It isn't clear that counts are wanted or needed, so sort -u text.txt? If counts are wanted, then sort text.txt | uniq -c works, optionally followed by sort -n to put the lines into frequency order.
Sep
12
comment Unix weird directory
@ShawnChin: I didn't expect the directory to be there but if the message was 'real' rather than noise, that's where it would be.
Sep
11
comment Unix weird directory
You might want to look for a directory â in the current directory with sub-directory dev containing a file nullâ. Alternatively, it is just the message that is scrambled, and your file really was saved to /dev/null, in which case, it is not going to be possible to get it back (you'll have to FTP it again).
Aug
31
comment How to find files on Linux where only root has read permission
If a file has 0 permissions (or other weird settings like 333), then the owner cannot at the moment read those files (though the owner could change the permission so that they could read those files). Also, if a directory on the path leading to the file is not accessible (the x-bit) to the general world (e.g. the directory is owned by root with 700 permission), then ordinary files under that directory are not readable by others, regardless of who owns them or the permissions on the file. So, there are other possible interpretations for the question, but the selected answer is most plausible.
Aug
25
comment How to kick off multiple shell scripts at startup
Look to the Xsession suggestion by Mr Ramsey.
Jul
26
comment Why can't I mount the same filesystem at multiple points, and why can't a mount-point inode reference count be > 1?
Two of about seven — an exaggerated version of many. I prefer that the addendum is a comment (or a separate answer) than a modification of my answer.
Jul
26
comment Why can't I mount the same filesystem at multiple points, and why can't a mount-point inode reference count be > 1?
@Neil Smithline: Please justify your 'many' variants by citing at least one non-Linux variant that provides what you describe: '25 July 2012 Update: Many Unix/Linux variants now support the -o union option that allows two filesystems to share a mount point. The second mount shadows the first in that all file accesses take place first in the new mount and then in the original mount. Also, file creation happens in the new mount.' Wikipedia has a brief outline but little specificity about which o/s other than Plan 9 support them.
May
29
comment What is the reason for rmdir(1) and rm(1) to co-exist?
One major downside of the mknod + link and unlink system was that creating a directory was not an atomic operation, so you could end up with a partially complete directory. There were lots of programs devised to check file systems for the inconsistencies that arose; fsck(1) is the one that survived.
May
29
comment What is the reason for rmdir(1) and rm(1) to co-exist?
Actually, back in the early days of Unix, neither rmdir(2) nor mkdir(2) existed as a system call; user root could use the mknod(2) call to create a directory node and the link(2) call to create the . and .. entries in the directory; and root could use the unlink(2) call to remove the directory entries.
May
3
comment Does the target in ln -s have to be a full path?
You ask about ln -s but your example uses just ln; which are you dealing with?
May
1
comment Unix tools: what if a file is named minus something?
To the 'close because off-topic' voter: This is a question about shell programming and how to avoid a problem. It is totally on-topic for SO. (OTOH, it is probably a duplicate; the problem is finding the relevant other question.)
Apr
29
comment How to get infinite command history in bash?
You could probably cut that down to 9999 in practice (or even 999; I use 1000). I've never found a history bigger than about 1000 to be useful. If I want to recover a command to make it into a script, I normally do that well within a thousand commands. Otherwise, it can go and there's no harm done.
Jan
31
comment Sudo segmentation fault in Terminal
By default, on a Mac, you cannot login as root. I don't have a root password set on my Mac, and don't expect to. That means that su doesn't work, either.
Jan
31
comment Sudo segmentation fault in Terminal
By default, on a Mac, you cannot login as root. I don't have a root password set on my Mac, and don't expect to. That means that su doesn't work, either.
Jan
17
comment egrep: CPU and memory usage
Split the file into separate segments and run separate egrep commands against each segment? How big of a file are you processing? Are you not I/O bound anyway? What is the regex you're using?
Jan
13
comment cron and at are not working
@tekknolagi: For 'at', I note that man at includes: IMPLEMENTATION NOTES Note that at is implemented through the launchd(8) daemon periodically invoking atrun(8), which is disabled by default. See atrun(8) for information about enabling atrun. When I tried on my system, at queued the job OK, but the jobs did not run. That was when I really read the man page! (When I did what man atrun said, my previously queued at requests ran at the next minute boundary.)
Jan
13
comment cron and at are not working
For the format of crontab entries, try man 5 crontab.