Skip to content
Advertisement

grep AND Operations

I want to simulate AND operation in grep . List all the file files contains “Some Words” and contain “Some Other Words” anywhere in the file. So far I tried # but it is not working. Answer Using GNU tools: The first grep lists files (-l) containing string1 -i: case insensitive, -r: recursive, -Z: file list delimited by ascii null

What is the internal format of .Xauthority file?

Well, the subject. I have searched a lot, but unfortunately, found nothing. Is there some document describing this format? Or the structure need to be extracted out from the xauth source files? Answer Probably not exactly what you are looking for but putting in an answer just for the formatting. The .Xauthority is an array of structures: You would probably

Sudo gets separate PID when starting a command

I do not understand why sudo gets a separate PID (e.g. 1620) while starting dockerd (e.g. 1628) with sudo? To which PID should I send SIGTERM to stop the dockerd? ps aux | grep dockerd pstree -ps Answer I do not understand why sudo gets a separate PID (e.g. 1620) while starting dockerd (e.g. 1628) with sudo? It is just

How to make a strict match with awk

I am querying one file with the other file and have them as following: File1: File2: This command: returns lines that overlap, BUT doesn’t have a strict match. Having a strict match, only Helen Stanley should have been returned. How do you restrict awk on a strict overlap? Answer With your shown samples please try following. You were on right

How can I save in a variable a portion of my cURL GET command?

I’m currently trying to setup an automated server on DigitalOcean API, and I need to extract the ID of my server to use it later in a command. My bash command is the following : The answer for the cURL command is this : I only need to save as a variable the first ID the cURL command gives me,

Understanding the output of gettimeofday

I am trying to understand the precision of the gettimeofday() system call. Here’s my program: The output if I run this program (./a.out 10) is, The seconds column seems to reconcile with the sleep of 1 secs. Can someone please explain what’s going on with the values in micro seconds column? It looks like the jumps from sleep to sleep

What does the z component of ncurses mouse events represent?

From ncurses.h What does the z coordinate represent? Answer From the curs_mouse man page: The z member in the event structure is not presently used. It is intended for use with touch screens (which may be pressure- sensitive) or with 3D-mice/trackballs/power gloves. Also, if you search lib_mouse.c in the ncurses source code for ->z and .z, you will find that

understand sysstat sar memory output

I’m preparing for more traffic in the days to come, and I want to be sure server can handle it. Running sar -q, the load of “3.5” doesn’t seem much on 32 CPU architecture: However, I’m not sure about the memory. Running sar -r shows 98.5% for the %memused and only 13.60 for %commit: running htop seems OK too: 14.9G/126G.

Advertisement