I’m trying to monitor syscalls for a binary using ptrace. The binary sleeps in pselect() and without ptrace, a SIGQUIT makes it return from pselect. The mask of blocked signals passed to pselect includes SIGQUIT. When executed with ptrace, it exits from sys_pselect6 but not all the way out of glibc’s pselect. What am I doing that prevents sys_pselect6 from
Tag: unix
cd command : how to go back an unknown number of levels from current subdirectory to a particular parent directory (unix and dos)
Ok, so I am trying to resolve a uri in an xmlcatalog and I want to go back from a particular sub-directory back to a parent-directory that is an-unknown-number-of-levels behind. eg: file:///D:/Sahil/WorkSpaces1/Cartridges1/Project1/ParticularFolder/Level1/Level2/<so-many-levels>/CurrentFolder I want to go back from “CurrentFolder” to “ParticularFolder” without typing in the full FilePath. I want to achieve this because, I work in multiple Projects which all
Run script when a command is executed irrespective of the command’s arguments
When any of these commands are run I want them to run a certain script. Something like alias ?=’some_script.sh’ (the question mark in this case means the rm command with any arguments.) How can this be done? I don’t HAVE to use aliases, anything that works is fine. Answer Don’t use an alias; define a function: The standard disclaimer when
Bash sort ignore first 5 lines
I’m having trouble ignoring the first 5 lines of my file while sorting the rest. My current command sorts the entire file by the second item, however I need to skip the first 5 “header” lines. I need read it and write it to the same file. Current Command Example Answer This sorts lines 6 and after of the file
How to print a binary value(1010) into decimal value(10) in GDB?
I want to print the decimal value of 1010 in gdb, but it prints the result as it is what I gave last. Answer GDB’s p[rint] command prints the value of the expression you provide, which is interpreted in the source language of the program being debugged. In C, your 1010 is a decimal literal, not a binary literal, so
Unix shell script to search for error codes in thousand files then print the count in text file
I need to find both 150+ eventType and errorCodes in 1700 files each day. That means i have to loop over 1700 files to find the occurrence count of 150+ eventType/errorCode and put those counts in a text file as a daily report. I have placed those eventType/errorCode values in a text file separated by commas: My initial code: The
How to delete numbers, dashes and underscores in the beginning of a file name
I have thousands of mp3 files but all with unusual file names such as 1-2songone.mp3, 2songtwo.mp3, 2_2_3_songthree.mp3. I want to remove all the numbers, dashes and underscores in the beginning of these files and get the result: Answer This can be done using extended globbing: This uses parameter expansion: ${fname##pattern} removes the longest possible match from the beginning of fname.
Insert space between numbers after matching specific pattern [closed]
Closed. This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 6 years ago. Improve this question I have the following temperature data that needs to be manipulated. Thought about using sed to insert a space in
How to get CPU Utilization number from top?
How would I get the number for CPU Utilization from running the top command on a specific user? Answer Pipe top to awk and add up the CPU utilization column: That awk command says “For rows (from top) greater than row 7, add up the number in field 9 $9 and store it in variable sum. Once you have gone
serial port: bytes from device all have their most significant bit = 0
guys tell me please what can be a problem – i send commands (sequence of bytes including bytes with most significant bit (MSB) = 1) to device through serial port, device successfully recognize the commands (so it seems all bytes are sent correct) and reply with almost correct answer. “Almost” here means than answer is correct except that all bytes