I’m writing a program which needed to be run on single core. To bind it to single core, I’m using sched_setaffinity(), but the compiler gives warning: implicit declaration of function ‘sched_setaffinity’ My test code is: Can you please help me to figure it out. Actually code is compiled and run, b…
Tag: linux
replace text between two tabs – sed
I have the following input files: and I am trying to find the second string between the two tabs (e.g. text2, abc2) and replace it with another word. I have tried with but it only deletes the tab and does not replace the word. I appreciate any help! Answer I would suggest using awk here: Set the input and out…
Stopping an unknown process in linux server
I have this command in my deployment process. But I want this process to stop and then restart while deploying in linux server. I checked and found that this is simply a JAVA process, and I can’t simply kill JAVA as other nimbus and supervisors are running too. So, how can I stop this process? Answer Yo…
Hamachi not installed on Centos 7 when i follow this steps
I’m trying to install Hamachi on Centos 7, i follow this documents but it was for Centos 5 ,6 Install and Configure LogMeIN ( Hamachi ) on RHEL/CentOS 5/6 Also the link of latest logmein-hamachi is not working, so i use latest version from this link LogMeIn Hamachi for Linux and download last version of…
How to keep 2 history files? One with timestamp, the other without
The reason I want to achieve this, is because I’d like to remove duplicates for easier command retrieval on the one hand, while still having the option of going over everything along with the timestamp, in case something bad happens, and perhaps going over what commands I executed can help somehow. Here…
Why is my cd not working in bash?
I have written small bash to automate my code The exe file is Occam2d and input file is start.txt. When I run my script I got Why? Answer With @anubhava’s comment:
sleep 0 has special meaning?
I’m seeing a lot of usages of sleep 0 in my one of my client project. The code look something like this. Reading through some of the answer of SO like this it seems that sleep 0 has some significance. What I want to known now is that does scheduling for other thread to run (if they are waiting to
How to replace recursively part of file name in bash
I have a directory having subdirectories containing images files with a wrong name such like filename.jpg.jpg i want to replace this recursiveley with filename.jpg i have tried: or but none works thank you Answer If you have a rename utility which uses perl regular expressions, then use the below command :
sorting rows of a data file with Linux
I would like to sort the lines of a data file (each line idependent from each other) from the first character. For example, if I have a data file I would like to end with something like I have tried to do it using the sort command, but it sorts the columns (not the line). Transposing the data file +sort
pthread not waiting for mutex lock threadFinished
Hi below is my coding snippet When statement1 & statement2 are commented I am expecting child thread to change my testrunning variable first before main thread but it is working properly only when statement1 and statement2 are uncommented. My question is why in child thread mutex lock is not locking my te…