14,281 reputation
15078
bio website
location
age
visits member for 4 years, 2 months
seen 16 mins ago

GNU/Linux user. Systems Engineer. Runner.


11h
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!
11h
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.
14h
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.
Mar
27
comment How to parse JSON with shell scripting in Linux?
To be fair, he wasn't asking to parse it with regular expressions. You could write a fine JSON parser in awk, it would just take a lot more time than anyone would reasonably spend on an answer for stackexchange. :) More seriously, jq has been useful to me: stedolan.github.io/jq
Mar
27
comment Result from kernel returned to what process?
Also helpful are the syscall manpages. A system calls response code is returned via an architecture-defined register (eax on x86). For system calls that return a lot of data, the arguments that you pass include an address where the data should be put. Your process can then just look at that same address once the system call returns.
Mar
27
comment What is the relationship between root and kernel?
I've added my commend to the answer with some links.
Mar
27
comment What is the relationship between root and kernel?
Processes running as UID=0 have superuser privileges; however, they still make requests of the kernel via the system call interface. A userspace process, even running as root, is still limited in what it can do as it is running in "user mode" and the kernel is running in "kernel mode" which are actually distinct modes of operation for the CPU itself. A userspace process running as root still only has access to the kernel mode features that the kernel exposes to it. See linfo.org/kernel_mode.html for more info.
Mar
27
comment What happens when I run the command cat /proc/cpuinfo?
linux.com/learn/linux-training/… and lwn.net/Articles/22355 (a bit dated)
Mar
27
comment What happens when I run the command cat /proc/cpuinfo?
Nice answer! On linux, if you want to dig deeper, the source for the proc filesystem is in fs/proc in the kernel source. You'll see that there is a fs/proc/cpuinfo.c but, unfortunately, it is rather empty since the heavy lifting is spread out all over arch/ as it is architecture dependent. For a simpler example see fs/proc/uptime.c. By glancing at the file we can guess that uptime_proc_show is the workhorse of what gets us the data we want and we could explore it more by diving into the functions it calls. To understand the seq_file interface and how it is used in procfs see:
Mar
25
comment Why is the service unavailable the second time?
So, this isn't an answer, but my guess is that if you want to figure out what is going on and it isn't logging, you will need to dig in a bit. How does tdtool talk to the daemon? A network port, an AF_UNIX socket, something else? If you aren't sure, I would try (1) run lsof on the daemon and see what files and sockets it opens. Do their state change after the first connection? (2) start the daemon in the forground and run it under strace. In another shell run tdtool, perhaps under strace as well.
Mar
25
comment Download Only a Part of a File
Are you referring to downloading using HTTP or some other protocol?
Mar
25
comment Does Public and Private key remain the same for a user or system?
"after I gave my public and private keys." As a rule you typically don't share the private key.
Mar
25
comment nc: bind failed: Address already in use
Nice answer. You might want to explain The releasing of the port 8140 takes some time to occur with a sentence or two about TIME-WAIT.