Reputation
1,891
Top tag
Next privilege 2,000 Rep.
Edit questions and answers
Badges
4 10
Newest
 Civic Duty
Impact
~168k people reached

Jul
15
comment Garbage in bash session log file. (using script command)
I always : man somecommand, before I use any command. Especially as similarly named commands have wildly different options on different systems (and sometime completely different actions too, such as "reset" which can either clear the terminal or reboot the host, depending on which system you are loggued into...)
Jul
15
comment Garbage in bash session log file. (using script command)
the easy way for the latter: open a putty session to the machine, cat the file, and right-click "copy all to clipboard". then paste into notepad (in case you added the usually usefull "copy also also the rtf in clipboard" option, pasting in notepad strips that out. the option is in other cases usefull in keeping some color info when pasting to word or similar)
Jul
15
comment best way to search my shell's history
ah ^^ well, ok, then it is back, in my mind, to a simple (and consistent) type of tagging.
Jul
15
comment How can I delete the 5th word of every line in a file?
the caveat here is that changing any field's value in awk has the side effect of rewriting the whole "$0" with only 1 separator between each fields. should be taken into account if you wanted to keep any alignment (unless gnu awk has an option avoiding this? regular awk/nawk will recompute $0)
Jul
15
comment Garbage in bash session log file. (using script command)
If you just want to replay in your terminal the session : more -v thescriptfile. otherwise you'll need, as said below, to avoid your shell (... and commands) to create those escape codes, or find a proper sed to get rid of them (very complex afterwards, as some escape codes look widely different than the ones you show, and thus could take out huge chunks of the real output if you only have regexp trying to get rid of those ones)
Jul
15
comment More succinct alternative to “lsof -p $(pidof postgres| sed -r 's/ /,/g')”
yes @A.B. . you can write, inside any nested "$(...)" as if you were writing at the top level (is, as if you were at the script's level). very much easier that all the backslashing you have to resort to when using the backticks.
Jul
15
comment What's a smart way to count the number of days since X?
@Kevin: If he wants to know how many days he worked somewhere, we can (until further advance in cryogenisation or medicine) not bother too much about this ^^
Jul
15
comment Run a script on a failed screen unlock attempt
does (or could, with some options set) some log file show anything when it happens? you could have a deamon script/program parse the log and react
Jul
15
comment best way to search my shell's history
I didn't knew that the kbd keyword would interpret correctly the "ctrl" and "+" ! I used to tag each key separately. thanks!
Jul
15
comment Bash script: do something one time inside a loop then stop, but continue looping
for the general case of "dobthe loop but dobsomething in it only once": inside the loop: [[ "IDidIT" = "Yes" ]] || { do it here... ; IDitIt="Yes" ; }
Jul
15
comment Where are my inodes going?
In adddition to the answers below, to find out who is creating many files, you could maybe get some results by using lsof and counting the processes with many occurences of file descriptors... absolutely not guaranteed (the program most likely only do them one by one...) but this may help to catch a "massively creating files in parralel" nasty program? ) actually, for those ones, top and similar programs can also help find who is massively using io)
Jul
15
comment Where are my inodes going?
Now i see why you do it that way, my mistake, sorry! it indeed allows only 1 find, more efficient and the sed is needed to get rid of the subdir+filenames. Sorry i misunderstood (read too quickly ^^)
Jul
15
comment Where are my inodes going?
Gilles, i usually love your answers, but here I think you can have better results with a ... -printf "x" | wc -c, avoiding the need to sed it down, and avoiding to count a file with embedded newlines as multiple inodes? and the 2nd way should be on find .*/ */ instead of find * ?
Jul
14
comment How to forward between processes with named pipes?
@Ali: line buffering instead of whole block(s) buffering is probably less efficient, this is normal. Just the "look for a newline" is less efficient than just copy n bytes. and the block-buffer sizes are custom-sized to be the most efficient in the most cases.
Jul
14
comment How to forward between processes with named pipes?
Nice question and researches. looking forward to the answers.
Jul
14
comment How to forward between processes with named pipes?
@Ali : the last chapter means that, as you have 2 line buffered programs (and especially the last one is!), the resulting output of the 3 will be line oriented as well. If your last program is buffered (add a | grep ^) then the resulting output to your terminal or file would be block buffered.
Jun
30
comment Still alive, still alive after kill -9 / SIGKILL
You may want to do : lsof -p pid to see what the process is accessing right now, it could help you to find out the bottleneck. If not, you can also attach to it with a debugger (ex: Gdb, gnu debugger), and see exactly what it is currently doing.
Jun
24
comment How prevent users from running commands via dot slash for a directory?
why does it matter that they use the full path? is "foo" not running correctly when using another relative path? (../bin/foo ? etc). what is the goal? (work around a bug in foo when invoked by something other that a full path? auditing where you want to know which of several "foo" was started? tell us the need, not the how)
Jun
21
comment What to use when the “ls” command doesn't work?
oh, it was just to save a few typing? ok, but I think it makes it more confusing than it should be (it's not codegolf ^^)
Jun
21
comment What to use when the “ls” command doesn't work?
misread ^^ sorry. why not just copy and use file? why the whole homedir thing? scp to desktop, file on it, and bash ./it ?