Reputation
20,717
Top tag
Next privilege 25,000 Rep.
Access to site analytics
Badges
4 68 88
Newest
 Good Answer
Impact
~1.6m people reached

Mar
20
comment Best way to start multiple “screen” scripts after restart? (centos)
Is this the forever program you are referring to? github.com/foreverjs/forever
Mar
20
comment Best way to start multiple “screen” scripts after restart? (centos)
apologies, I hit enter too fast. Just updated my comment with a more sensible question :D
Mar
20
comment Best way to start multiple “screen” scripts after restart? (centos)
"We are using centos." which version? Also, why the aversion to starting these scripts using the init system, are there requirements leading you to use screen rather than your system's init setup or another process manager
Aug
1
comment How to run no more than n parallel subshells
Note: Ole Tange (the author of this post) is the author of GNU parallel.
Nov
14
comment GDB cannot exec my test program
@Barmar It doesn't need to, but it does so to make it easier for the user. For instance, it allows you to specify command arguments that can be expanded by the shell (for instance globs such as * in paths). In gdb 7.7 or greater, set startup-with-shell false will tell gdb to exec your program directly. In versions older than that, it is a compile-time option.
Nov
6
comment How do I print pi (3.14159)?
@DavidRicherby Fewer digits can be printed via an additional invocation of cut. More digits can be printed by waiting a long time and running the command again.
Nov
5
comment keep the last file of every month and delete the rest
@VamsiKrishna I'm sorry this script isn't working for you. It isn't clear to me why find would be emitting that error. The only errors I see when running it are from rm related to missing files. Perhaps there is something non-portable about my script. I am using BSD tools (from OS X) with Bash. My recommendation would be to look at the patterns used by the solutions in the various answers and then create a solution that use similar patterns but that work with the tools available to you.
Nov
5
comment keep the last file of every month and delete the rest
Is the "above condition" just the 30th of every month, the last calendar day of the month, or the latest day you happen to have data for in that month?
Oct
30
comment Open a new bash with sudo powers without reentering the password
I guess in theory you could use your root privileges you could rewrite the timestamp file used by sudo to track credential caching to include a record for a new tty of your choosing. You'd probably need to take a look at the sourcecode of sudo to make sure you are writing the contents correctly.
Oct
30
comment Open a new bash with sudo powers without reentering the password
D'oh, didn't see the duplicate when I was writing my answer. I agree this should probably be closed as a dup.
Oct
28
comment Process Files to create a new file
Hi, I significantly edited your examples to make it easier for others to potentially help you out. Can you confirm that they still reflect what you are trying to do?
Oct
26
comment Buffering (named) pipe in GNU OS
@AlKlimov It appears that you can set the capacity of the pipe using the F_SETPIPE_SZ fcntl. See man7.org/linux/man-pages/man2/fcntl.2.html for more info.
Oct
25
comment Write to stderr
Huh, I swear I tested my comment here before making it, but now I'm definitely not getting red syntax errors so I'm not sure what happened. Apologies for misleading comment :)
Oct
25
comment Write to stderr
Unless your /bin/bash is statically linked, it will honour LD_PRELOAD since that is actually handled by the dynamic linker. However, it won't be affected to changes to LD_PRELOAD that are made after it has started. If you start bash with the LD_PRELOAD in place, you would get syntax errors in red.
Oct
24
comment How can I grep a certain text and display its line and the line after as well
@Emmanuel Cleaned up the awk answer, thanks!
Oct
24
comment How can I grep a certain text and display its line and the line after as well
@Emmanuel I didn't, was a sloppy copy-paste-and-edit from another command in my shell environment.
Oct
24
comment Reverse DNS PTR lookups ocurring on each connection
Actually, it looks to me like you /have/ found the issue. When you connect over 22, SSH is likely doing the dns lookup, you can stop it by adding UseDns no to your sshd config and restarting the daemon. On 80, it looks like your python process is clearly doing the lookup.
Sep
23
comment Telnet no echo output from xinetd script
Can you include your xinetd service configuration? Your script works fine for me.
Sep
20
comment top not showing the memory usage of cat
@mr.eightnoteight Correct. If I run cat file >other_file where file is 4GB, cat is /not/ reading all 4GB into memory and then writing it all. If you use the strace utility, you can see that it is reading a chunk, then writing a chunk. On my system, cat read 1MB at a time.
Jul
8
comment List explicitly installed packages
@jmiserez Hrm, it has been a while since I've looked at this one. Do you have the list of packages that this missed?