linux

cannot write to pty - linux

i am the owner of the pty device created like this permissions are crw-w---- mknod pty1 c 1 1 cat > pty1 tells me operation not permitted. what i want to do later is that i open the file from a program using open and call write to send output to the terminal, as if it is a disk file. why is cat not working. can we write to a pty or ...

Package libsndfile-dev has no installation candidate

I am trying to install "libsndfile-dev". I do the following: sudo apt-get install libsndfile-dev As the result I get the following: Reading package lists... Done Building dependency tree Reading state information... Done Package libsndfile-dev is a virtual package provided by: libsndfile1-dev 1.0.17-4ubuntu0.8.10.2 You shoul...

How do I pass an enviroment variable to a Netbeans Makefile on Ubuntu?

I'm using Netbeans on Linux (Ubuntu 9.04) to build a C project. How do I pass in an environment variable so that's it's visible to the Makefile? If I do a normal export MYVAR="xyz" and then run make from the command line this works fine of course. But Netbeans doesn't seems to use the .bashrc environment, so if I click "build" in Netb...

Lightweight query server

I'm looking for some service server that is extremely simple and lightweight. It's supposed to be used by administration scripts or simple apps to query for information that is available only as root on other server. I don't need high-throughput, stateful processing, etc. Only blocking, synchronous queries required. Preferably no HTTP s...

Locking files in linux with c/c++

I am wondering if you can : lock only a line or a single character in a file in linux and the rest of the file should remain accessible for other processes? I received a task regarding simulating transaction on a file with c/c++ under linux . Please give me an answer and if this answer is yes ,give me some links from where i could take a...

What core is running my process?

I am currently taking a parallel programming class and our first programming exercise was to create four threads that displayed a "hello world" kinda of message. I would like to know what cores are running the threads. I have tried using the TOP command on Unix to display all processes and I do see the 5 different threads, but not sure h...

Locking and unlocking files using C API in Ubuntu LInux

Hello, How can I lock a file for a specified period of time (10 seconds) using the C language in Ubuntu Linux ? ...

How do you change a user password in a script with busybox and openssl?

I need to synchronize a user account and password to an external source on a system with busybox and openssl installed. When the external source tells my system to update credentials, how do I change the user's password in a script? I will have the password in plain text. This has to be automated, and from what I can tell busybox pass...

Are Bash and Linux shell the same?

I often getting confused with bash and shell. Are they same? If I want to learn the bash, will it be covered with Linux shell programming related books? I use Ubuntu Linux. Edit: (Added after getting two answers.) How bash is associated with terminal? ...

What's an alternative for DTrace on Linux?

From what I can see, a DTrace implementation on Linux is held up by licensing and politics. What are the alternatives currently? ...

Practices while releasing the python/ruby/script based web applications on production

I am purely a windows programmer and spend all my time hacking VC++. Recently I have been heading several web based applications and myself built applications with python (/pylons framework) and doing projects on rails. All the web projects are hosted on ubuntu linux. The RELEASE procedures and check list we followed for building and...

Is there anything like Apple's Shark on Linux?

I'm looking for alternatives to Apple's Shark on Linux. I'm looking for a statistical profiler - not gprof. I know about oprofile, but would like something a bit more polished. Appreciate any suggestions with advantages/disadvantages relative to Shark. ...

How to use the xdg-mime command

Can someone provide example on how to use (with GNOME Ubuntu) the XDG-MIME command? I'm struggling to get anything working even with the docs. For example if I want to register the extension .mfe with an application called MyApp what would the steps be? This is my attempt so far, I would appreciate any pointers on getting this right... ...

Copy Table data from one DB to another

For development I find myself needing to copy table information from one table to another quite often. I am just curious what are the easiest solutions to do this for Postgres. I have PGAdminIII but it looks like it really only support the long drawn out Backup/Restore. Is there a python or bash script somewhere or something that I ca...

fgets() linux vs mac

Does fgets on a mac read until a carriage return '\r' or does it also depend on the new line '\n'? Reason is I am using fgets to read a file a line at a time. However if it is run on a mac file with only '\r' for the line ending it fails to do what I want. (run in linux) I don't want to be writing library type functions to deal with cr...

Zip function junk directory paths

Wow I feel silly asking this question but here goes. I'm creating a zip file by relatively specifying file locations. Here is an example of the command I'm running: zip priv/purchases/test.zip priv/audio/5001.mp3 priv/audio/5002.mp3 When the file compresses it maintains the relative paths of the files. Thus I get a file hierarchy of: ...

Number of inodes in a partition not matching up to the maximum number of inodes the partition should support

We are using Amazon EBS to store a large number of small files (<10KB) in a 3-level directory structure. ~/lists# df -h Filesystem Size Used Avail Use% Mounted on /dev/sda1 9.9G 3.9G 5.5G 42% / tmpfs 854M 0 854M 0% /lib/init/rw varrun 854M 64K 854M 1% /var/run varlo...

Running a script with the help of GRUB and menu.lst?

Can't I run myScript by appending a line to the entry of Linux in /boot/grub/menu.lst as: title Ubuntu 9.04, kernel 2.6.28-11-generic uuid b20f1720-b3f5-4162-bc92-ab2deb8d5d04 #kernel /boot/vmlinuz-2.6.28-11-generic root=UUID=b20f1720-b3f5-4162-kernel/boot/vmlinuz-2.6.28-11-generic root=UUID=b20f1720-b3f5-41...

How do I maximize power consumption on a linux laptop from software?

I would like to maximize power consumption on a linux laptop (ubuntu with openbox) to discharge the battery as fast as possible. I would like it to be done purely from software without user intervention. Which strategies would be useful to do this? The ones I can think of are: Switch off power-save functionality (tips on how to do this...

How do I exclude a folder when performing file operations i.e. cp, mv, rm and chown etc. in Linix

How do you exclude a folder when performing file operations i.e. cp etc. I would currently use the wild card * to apply file operation to all, but I need to exclude one single folder. The command I'm actually wanting to use is chown to change the owner of all the files in a directory but I need to exclude one sub directory. ...