Closed. This question is off-topic. It is not currently accepting answers. Closed 10 years ago. Locked. This question and its answers are locked because the question is off-topic but has historical significance. It is not currently accepting new answers or interactions. I need to download a file from server to my desktop. (UBUNTU 10.04) I don’t have a web access
Tag: unix
Adding newline characters to unix shell variables
I have a variable in a shell script in which I’d like to format the data. The variable stores new data during every iteration of a loop. Each time the new data is stored, I’d like to insert a new line character. Here is how I’m trying to store the data into the variable. VARIABLE=”$VARIABLE ‘n’ SomeData” Unfortunately, the output
How to detect and find out a program is in deadlock?
This is an interview question. How to detect and find out if a program is in deadlock? Are there some tools that can be used to do that on Linux/Unix systems? My idea: If a program makes no progress and its status is running, it is deadlock. But, other reasons can also cause this problem. Open source tools are valgrind
Run a persistent process via ssh
I’m trying to start a test server via ssh but it always dies once i disconnect from ssh. Is there a way to start a process (run the server) so it doesn’t die upon the end of my ssh session? Answer As an alternative to nohup, you could run your remote application inside a terminal multiplexor, such as GNU screen
Run Another Program in Linux from a C++ Program
Okay so my question is this. Say I have a simple C++ code: Now say I have this program that I would like to run in my program, call it prog. Running this in the terminal could be done by: Is there a way to just do this from my simple C++ program? For instance Any feedback would be very
Re-opening stdout and stdin file descriptors after closing them
I’m writing a function, which, given an argument, will either redirect the stdout to a file or read the stdin from a file. To do this I close the file descriptor associated with the stdout or stdin, so that when I open the file it opens under the descriptor that I just closed. This works, but the problem is that
Is XCB ready for production use? Should I use Xlib instead?
If one needs low level access to X11 events, windowing and input without using GTK, QT et al., should one use Xlib or XCB? What are the pros and cons of each? Answer You can use both of them. XCB is simpler to use, has a better response to a multithread environment but lacks documentation, while Xlib is a more
Open All files named generator.yml in all subdirectories of current directory in gedit
I’m no expert at shell scripting so I just want a quick answer. I tried something like but It just doesn’t work because it’s just a stupid guess. So what’s the correct way? UPDATE: answers by Jaypal Singh , kev and Sorin were very helpful but kev’s answer covers more cases so I’m marking that correct. Answer Or
What is a .pid file and what does it contain?
I recently come across a file with the extension .pid and explored inside it but didn’t find much. The documentation says: A Pid-File is a file containing the process identification number (pid) that is stored in a well-defined location of the filesystem thus allowing other programs to find out the pid of a running script. Can anyone shed more light
Concatenating Files And Insert New Line In Between Files
I have multiple files which I want to concat with cat. Let’s say I want to concat so that the final file looks like: Instead of this with usual cat File*.txt > finalfile.txt What’s the right way to do it? Answer You can do: Make sure the file finalfile.txt does not exist before you run the above command. If you