Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers. We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations. Closed 5 years ago. Improve this ques…
Tag: linux
Compiling linux sources in Windows environment
I got a source for console program written in c++ for linux Is there a (automated) way to compile this source to run in windows? and what about linux functions and libraries called in this file? Answer It depends on the source, but if it’s using linux functions and libraries, installing Linux might end …
How to run infinitely script in background on Linux?
I have a PHP script with infinite loop. I need this script running forever. So, I run And it works in background in my current user’s security context. But when I close terminal window (log off), of course, CentOS Linux kills my program. I see two guesses: run from a different user in background or make…
Change the target of a symlink with PHP
How can I change the target of a symlink with PHP? Thanks. Answer You can delete the existing link using unlink function and recreate the link to the new target using the symlink function. You need to do error checking for each of these.
Get directory path by fd
I’ve run into the need to be able refer to a directory by path given its file descriptor in Linux. The path doesn’t have to be canonical, it just has to be functional so that I can pass it to other functions. So, taking the same parameters as passed to a function like fstatat(), I need to be able …
Prevent * to be expanded in the bash script
Linux bash script: Execution results: * is expanded to the list of files, which is actually script itself. How can I prevent this and see actual variable value? In general case, var can be more complicated than *, for example: home/alex/mydir/*. Answer you need to escape your variables, too: And in your funct…
linux batch rename directories and strip # character from name
i have a directory with a lot of subdirectories with a # infront of them: I want to rename them all and remove the # caracter I tried to do: but didn’t seem to work. Any ideas on this. Thanks Answer Just use use -n just to check that what you think it would happen really happens. In you example
Limiting the time a program runs in Linux
In Linux I would like to run a program but only for a limited time, like 1 second. If the program exceeds this running time I would like to kill the process and show an error message. Answer StackOverflow won’t allow me to delete my answer since it’s the accepted one. It’s garnering down-vot…
Program configuration data in Unix/Linux
What is recommended way to keep a user configuration data in Unix/Linux? My programming language is C++. Configuration data will be kept in XML/text/binary format, I have no problem with handling such files. I want to know where can I keep them. For example, in the Windows OS configuration data may be kept in…
Error compiling BASIC “libnotify” code
Compiling the code gives me “undefined reference to” error: I took the code from this blog. Answer Sounds like you forgot to pass -lnotify to actually link against libnotify.