linux

rsync remote site with bash

Hello All Hope you can advise I want to use rsync to carry out my FTP transactions but with bash. How can I add the password to the rsync command. I have for example. rsync -r -update [email protected]:/public_html/ /var/www/domin.com/public_html Hope you can advise. Thank you in advance. ...

What does #!/usr/bin/... at the start of a file mean?

I can do something like this in Haskell: #!/usr/bin/runghc main=putStrLn "Hello World" Then I can run it with ./hello.hs My question is, why is the first line ignored? Comments in haskell start with -- but the first line still seems to be ignored. It even loads in ghci. The trick also works with Python and Perl. But when I do someth...

I need some new blogs to help learn my new language (it's C).

I'm a BIG blog reader. I can't stop reading blogs. Blogs helped me find this site (in particular Jeff's blog). However I've come to realize that all the blogs I read deal with one language. Coding Horror Fabulous Adventures In Coding Jon Skeet's Blog Scott Hanselman's Blog Did you guess the language? Well now I'm learning C and usi...

X11: run a gnome app as another user

I have ubuntu + x11 + gnome. I want to run a graphical application as another user. However, when I start it from the command line using sudo -u otheruser app I get the error "No protocol specified". How can I work arround this? ...

How to compare 2 symbolic links in unix (Linux)?

What would be an elegant way of comparing 2 symbolic links in Unix? Assume I have entered the following commands: ln -s /usr/share/g s1 ln -s /usr/share/g s2 ln -s ../share/g /usr/lib/s3 ln -s /usr/share/h s4 then I would like to have a command that says that s1 and s2 are equal (whether /usr/share/g actually exists is not relevant),...

Getting List of Static Libraries used in an executable

Since ldd lists only the dynamic libraries. Is there a way to extract the info. about static libraries used to create the executable ? TIA, Saurabh ...

memcached - using with a C# asp.net application

I'm considering using memcached (at some point) in my application i'm currently developing. Eventually, i'm planning on hosting this on Amazon EC2 - i was just wondering, would it be possible to have a linux server (aws instance) running memcached, and use the windows server (aws instance) for the app, but set it to use the linux serve...

How to develop linux screen saver

Does anyone have a link or document on how to write a screensaver for Linux? ...

Is there any way to run an application as a screensaver in Linux

I want to run a full-screen application as a screen saver. Is it possible in Linux? It seems that XScreenSaver is not capable of doing this and GnomeScreenSaver has this in their wish list. ...

What is the role of Magic Number in boot loading in Linux?

Hi all, I was going through the details of the linux boot process. It was understood that the primary boot loader resides in 512 byte image (program code + partition table). The 510 bytes comprise of executable code, error messages and partition table information. And the last 2 bytes contain a magic number 0xAA55. It was mentioned that...

nanosleep high cpu usage?

I noticed that a little test program which calls nanosleep is showing a huge difference in CPU usage when run on Linux machines with a kernel newer than 2.6.22. #include <time.h> int main (void) { struct timespec sleepTime; struct timespec returnTime; sleepTime.tv_sec = 0; sleepTime.tv_nsec = 1000; while (1) { ...

Where does pp (PAR) unpack add (-a) files?

This is my attempt to cut through extraneous issues raised "Why don’t my system calls work in the Perl program I wrap with pp?" I have created a simple Perl script on a linux system: new-net:~/scripts # cat ls_test.pl @ls_out = `ls -l`; map { print "$_\n" } @ls_out; $out = `sh out_test.sh`; print "$out\n"; This script calls a simp...

How to get network adapter stats in linux/Mac OSX?

I'm looking for a way to get hold of network stats in C on Linux and MacOSX. Specifically, I need to monitor the number of bytes uploaded and downloaded from each network adapter on the system - I don't need to do packet inspection, or differentiate between protocols, just a 'total bytes' counter which I can poll at intervals would be fi...

How to issue "module load" in a shell or Perl script (i.e., non-interactively)

I can use the "module load xyz" command interactively, but when run from a script, it says it can't find the "module" command. Is there any way of loading modules in a script? ...

Wget creates output file even when page does not exist.

Hi, Is is possible to prevent Wget from making an output file when there is an error like 404. When I run wget -O my.html http://sdfsdfdsf.sdfds http://sdfsdfdsf.sdfds does not exist but Wget still creates my.html I am making a bash script and want to make sure it stops if wget can't get a valid file. ...

Windows, Linux and Memory Management

I'm pretty curious about how Windows and Linux does memory management with C++ programs. The reason of this curiosity is because I've just made 3 very simple programs in C++ portable between Linux and Windows. The code was exactly the same. The hardware too. But the results were incredibly different! Both tests were repeated 10 times an...

Best operating system for C++ development and learning

What is the best operating system to develop while using C++? I would like the OS that has more tools and software for C++ development. I also want to develop only for the command line, because I find GUI development in C++ to be confusing. ...

How might I perform DNS lookups using C/C++ on Linux?

How do I get similar functionality to the host command using a c api (or any other language for that matter)? I need more information than just an IP address given by gethostbyname(); specifically, the SMTP-related data. ...

Systemtap effect on performance

I'm looking for some real information about the effect of systemtap on performance. I know that static kernel probes are documented somewhere on their website (with stats), but what about userspace probes? I saw this post on their mailing list (http://sourceware.org/ml/systemtap/2009-q1/msg00518.html) which points at a possibility of si...

Linux softphone with CRM integration?

What I want is a SIP softphone that can run on Linux and popup browser window on incoming calls, like: http://www.mycrm.com/contact?phone=#detected_phone_number# ...