Lets say I have a container running and I do Then I detach from this container and want to attach again If I do this I wont go back to that bash that I created. Instead I will go to the main process. How can I attach to that bash again ? Answer You can’t. While the docker exec documentation
Tag: linux
Linux asynchronous epoll() server having problems when EPOLLRDHUP occurrs
I’m trying to make an asynchronous web server using epoll() in Linux, but problems occur whenever the event EPOLLRDHUP occurs. When the flag EPOLLONESHOT is not set, the server tries to process a useless event (not EPOLLIN or EPOLLOUT) multiple times during the loop without stopping, which causes the se…
CLI tool to format XML files keeping empty lines and comments
Is there any CLI tool for Linux which formats XML files keeping any empty lines and comments? I have tried xmllint, tidy and xmlstarlet, but all seem to focus completely cleaning XML files rather than just indentation and spacing. Answer Try xmlindent. It has several options like -nbe and -nba and others that…
How to use back-reference of sed replacement command correctly considering a special Regular Expression
I am learning the sed s/regexp/replacement/ command on linux. There are some numbers from phone.txt I’d like to use the regular expression (which I have tested on https://www.freeformatter.com/regex-tester.html) to match numbers which begin with (555). And then I want the output of these three parts of …
Segmentation fault when using memory with custom ELF file
I am trying to program a small ELF program with a custom ELF header but have a segmentation fault whenever i am writing to memory. Why would that code trigger a segmentation fault ? %assign LOAD_ADDRESS 0x08048000 BITS 32 org LOAD_ADDRESS ; load address ehdr: ; Elf32_Ehdr db 0x7F, “ELF”, 1, 1, 1 ;…
Bash Scripting checking for home directories
I’m trying to create a script to check if user accounts have valid home directories. This is what i got at the moment: This works. I get the expected output which is the username of the account with an invalid home directory. eg. output However, I am unable to make it so that ONLY if there is no issues …
Linux perf_events annotation frame pointer confusion
I ran sudo perf record -F 99 find / followed by sudo perf report and selected “Annotate fdopendir” and here are the first seven instructions: push %rbp push %rbx mov %edi,%esi mov %edi,%ebx mov $0x1,%edi sub $0xa8,%rsp mov %rsp,%rbp The first instruction appears to be saving the caller’s bas…
Unable to connet to SQL server using soci library
I am beginner in c++,my problem on Linux for connecting to SQL Server with soci library, my code this but I have error and I don’t found solution for my problem, my code this: I have error: Here is the code: Answer Your ODBC connection string in incorrect, your first parameter specifies a datasource cal…
Docker difference docker run[…] docker container run […]
Is it difference between this commands? In addition then why in second command uses -i(Interactive) and -t(TTY)? Answer docker container run is equivalent to docker run, as well as nearly all docker container commands can be found without container subset. About -it. t creates console (tty), and i forwards yo…
Live Linux grep script – only print positive results
I try to code a bash 4 (or sh, if that’s possible) script that does the following: 1st parameter: the path to the compressed modules to search, could be “.” 2nd the search pattern to look for The script so far looks like this (be aware that it is not foolproof, it not checks if both paramete…