On linux, wrote a simple program to create a POSIX message queue, and send a msg to it, after the process terminated, it seems the msg is still there. The questions are: Does the msg still there after reboot? If it exists, then it’s on disk, how did it guarantee the performance if it stores msg on disk instead of
How do I replace all lines after line XX in one file with content from another file?
I’m on Debian 8.2. Here’s test.sh so far. I want lines 26 onwards of fileA’s content to replace everything in fileB from line 26 onward — so I end up with the first 25 lines of the output are from lines 1-25 of the original fileB and the remainder is lines 26 onwards of fileA. How do I do this?
Linux tar command ignore files which permission denied
I encountered an issue when I tar a directory. There is a backup file in one of the sub directory created by another user and it doesn’t allow other user to read. so my tar command was failed. My question is: Can I ignore this file (actually this file is not important) and tar the rest of the files/directories? Answer
How can i save automatically the SSH_CLIENT at login?
i want to save the user’s IP when he connects to it’s home folder, this is because i’m a user in a server where my team has a folder where our public_html is located, but we use the same account, so i just want to register who connected. So i want to make a script that triggers when a connection
link count and ls command
I’m learning file link count. Only when link count reaches 0 can file’s contents be deleted. In my test the process opens a file in directory “/home/hel/myfile” and sleep 10(s). At the same time I delete it using “rm /home/hel/myfile”. Then I use command “ls” and display No such file. But in fact, the file still exists because the fd
Iterating over lines in a file with “for” in shell never matching target
i wrote a shell script as you can see followed. The script reads all line which in .dat file and writes screen matching words according to specified parameter but if/else block doesn’t properly.Both block if and else fired same time. sh file dat file terminal result Answer The original code didn’t ever look inside of a file until after running
errno.h socket/connection error classification
I’m using boost::asio on linux to send http request, using almost exactly this code boost asio http I want to catch exceptions and classify them using errno.h error codes to three groups GROUP 1. errors occurred because of local host socket/connection. GROUP 2. errors occurred because of local host or remote host or third party. GROUP 3. errors occurred because
Reuse char * pointer needs to free and malloc again?
I would like to implement a main function such as in order to execute system commands. The following code is currently used : Because I need to enter other commands, I am currently using the same cmd_buffer by using free() before reallocating memory. Is it the right way to do ? Some other commands might be required in the future.
How do I restart wlan0 with the static ip instead of a dynamic ip? [closed]
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers. This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question
Unix cat command problems [closed]
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers. This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question