15,604 reputation
15283
bio website
location
age
visits member for 4 years, 3 months
seen Dec 9 at 20:15

GNU/Linux user. Systems Engineer. Runner.


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?
Apr
5
comment How do I restart the network or ask the system to seek a refresh IP from the DHCP?
Added some more that I found that might help.
Mar
27
comment What is the relationship between root and kernel?
@RonVince It depends on what parts of the system you would like to learn. For some of the questions you have been asking, I would recommend a combination of /Advanced Programming in the Linux Environment/ by W. Richard Stevens and your system's development manpages.
Mar
27
comment How to parse JSON with shell scripting in Linux?
@user3086014 I'm sorry, but I won't be putting more work into this answer. Take a look at the Ruby example I have there. It should give you a good place to start on how to get tags out of various parts of the JSON you want.
Mar
27
comment libpam load pam modules at every connection
Out of curiosity, did your debugging actually show that PAM loading was slow compared to the other parts of starting the session? If so, is PAM doing a lot of work to do authentication or is it really just the loading that is slow? Sorry to ask so many skeptical questions, it is just very surprising to me. I would expect other portions of the connection to dwarf simply loading the PAM modules. For example, if you have "UseDNS" set to yes.