Skip to content

Tag: linux

C++ Sockets – Client gives segmentation fault (linux)

I created a server/client connection. The server and client both are compiling correctly but when I run the client, it gives me a Segmentation Fault (core dumped) I don’t know what I am doing wrong with my memory allocations. The program is not dangling or anything. I think my program is writing to a re…

ps command -o option gives “ERROR: Garbage option”

I have 2 suse-11 machine both has same kernel version. Linux version 2.6.32.59-0.7-default (geeko@buildhost) (gcc version 4.3.4 [gcc-4_3-branch revision 152973] (SUSE Linux) ) #1 SMP 2012-07-13 15:50:56 +0200 but in one machine below command works ps -u test-o ‘%U %p %P %c’ but in other gives erro…

Regext to match only ONE occurance of a pattern

How to write a regex that says that given pattern is present ONLY once? for e.g.. if am searching for pattern ‘file’, Answer You could use a negative lookahead: Test at regex101 You may apply the above regex in grep. The negative lookahead assertion at ^ start (?!(?:.*?file){2}) looks ahead, if th…

Bash: multiple redirection

Early in a script, I see this: And later: My understanding of this looks something like this: Create fd 3 Redirect fd 3 output to stderr (Upon app execution) redirect stdout to fd 3, then redirect stderr to stdout Isn’t that some kind of circular madness? 3>stderr>stdout>3>etc? I’m esp…