Reputation
21,732
Next tag badge:
97/100 score
27/20 answers
Badges
2 26 76
Newest
 Nice Answer
Impact
~1.7m people reached

  • 0 posts edited
  • 6 helpful flags
  • 1,997 votes cast
Jun
29
comment How can I count the number of whitespace characters in a file?
@Alison - your method might seem indirect, but I don't think that's the case. No matter how you do this task, you have to have a program that examines every character (every byte) in the file. There's no short cuts for that I can see. "Deleting" isn't really the case, as tr actually just passes all whitespace characters down the pipe. It's just selective about what characters it passes, rather than "deleting" anything.
Jun
25
comment Can tarring files improve compression?
The "random" file contents are a problem. They're incompressible. Use two different large text files to get a better idea. A related idea here is "normalized compression difference". You might take a look at ims.cuhk.edu.hk/~cis/2005.4/01.pdf to see what kind of problems you can encounter doing this kind of testing.
Jun
25
comment Comparing Oracle version in bash script
@triplus - Glad I could help. The custom is to upvote good answers, and mark the best or correct answer.
Jun
23
comment Wifi cuts out after some time
In addition to the Wi-fi chipsets of both laptop and router, you should mention the age of both laptop and router. I've read people speculating that "low noise amplifiers" wear out when they age. I've certainly experienced the symptoms you describe, but all of my gear is either used to hand-me-downs, so I never experienced it new.
Jun
22
comment Extract just the hostname and port number from tnsnames.ora file
There may not be a good way to reliably get the Service Identifier without a full parse of the descriptions. I don't see a good way to shortcut a grammar-based solution. The only reason my awk-based solution to finding the "HOST" value works is that I could make name/value pairs out of the descriptions.
Jun
22
comment Kernel driver for wireless adapter not in use
@TheDerkus - I've never set up or used a dual boot machine, and I only use Windows at work. I would guess that you could mount the Windows disk when you've booted from a USB drive, but I don't know for sure. That's really another question.
Jun
20
comment How can I shorten strings shown in the i3status bar?
@pleasedeleteme - I think you're out of luck. If you read the i3status man page, the author(s) explicitly write that they didn't want to reimplement job control, so there's no way to do what you ask. Sorry.
Jun
18
comment Why does the terminal echo keystrokes when commands are running?
Since the rest of the TTY system seems like a good design, I'm guessing this feature is there on purpose, and that purpose is to allow type-ahead. PDP-11s probably took a lot of time waiting for disk or tape input, so type-ahead would have been a real benefit.
Jun
18
comment Why are file names surrounded wtih “â” sign?
Thanks. I'm not sure that all the steps I took to duplicate are necessary but... 1. Use PuTTY, setting "Translation" to ISO-8859-1. ssh to linux machine. 2. Unset environment variables LC_ALL, TERM, TERMINAL, XTERM_LOCAL. 3. set environment variable LAN=en_US.UTF-8. I finally got UTF-8 left- and right-single quotes, 4. Run dash shell. I got ASCII single-quote bytes for all the other combos of xterm, LC_ALL, LANG, TERM, TERMINAL, etc that I tried. I also got the a-circumflex-file1.txt-a-circumflex as the question has: no visible characters after the a-circumflex as in your example.
Jun
17
comment Why are file names surrounded wtih “â” sign?
How did you get the first rm to generate UTF-8 quotes? I'm having trouble duplicating that. I can't tell if my locale is off, or if I've got xterm doing something right, which is wrong for getting an erroneous condition.
Jun
10
comment What is the technical term for command line application environment programs?
@user216125 - a lex/yacc interpreter is overkill for simple situations, but the dividing line between simple and complex sneaks up on you. It's usually pretty easy to get lex to recognize new tokens, and yacc to incorporate them in a parse tree. It's easy at first to do your own token recognition, and maybe recursive descent parsing, but soon enough, it's hard to add that new command. yacc gives you a grammar, with which you can recognize more kinds of input. A bash "while read" loop is fairly inflexible as far as number of tokens in a command, and recognizing tokens once you've got them.
Jun
5
comment Php shell_exec() : for non root user, how to access root command
You'll have to give use some more information. At a minimum: (1) the code that generates the .tar, which I assume is just a few lines. (2) How you know the shell_exec() call fails - what error messages, etc. (3) What appears in /var/log/httpd/error_log, or where ever CentOS keeps it's apache error log files. (4) The permissions and ownership of "my shell script"
Jun
3
comment Unable to run an executable built with NASM
Just so I understand, you're assembling x86 (i386) 32-bit code on a 64-bit installation?
Jun
3
comment How are file types known if not from file suffix?
Note that even for regular files (not device files, unix domain sockets, named pipes, etc) "file type" can mean two different things: (1) A particular file format (".docx", XML, MS-DOS text format, RTF, fixed-length records, the list could be very long) or (2) A file that a particular app knows how to deal with (".xlsx" or ".doc" or whatever, there's overlap with the format type). It's worth keeping that distinction in mind when talking about "file type".
Jun
2
comment Spelling mistakes in the file?
Are you sir tin you went to automatically correct all miss spilled words? You will miss out on a lot of correctly spelled words that are in the wrong place, or you'll have the auto-correct put correctly spelled wrong words in place of incorrectly-spelled words. It's a hard task.
May
29
comment What does an @ symbol denotes in the beginning of a unix domain socket path in Linux?
For what it's worth, the more modern ss program also shows socket endpoints like "@/tmp/.X11-unix/X0"
May
22
comment Why is sudo slow when I mistype my password?
@jordanm - thank you! That's exactly what I'm looking for to penalize the Chinese ssh password guessers.
May
22
comment How can I end a here-document that starts with <<\\$fff?
@G-Man - much obliged for the thorough and well-thought-out answer to what I had assumed was a rhetorical question. Sometimes rhetorical questions have answers, I reckon.
May
21
comment How can I end a here-document that starts with <<\\$fff?
Pedagogically, why would you put a question like that on a test? It's a corner case at best, probably a worst practice, and easily and habitually avoided by every "here document" writer ever. Sometimes you've gotta wonder about academics...
May
21
comment What does this grep expression mean?
We need to see the exact command you invoke. As it stands, the backslashes might be to protect '*' and '?' from shell expansion, or to keep grep from treating them as metacharacters.