unix

Is there a way to get battery level using unix c program

is there any way to create a daemon in unix that would monitor my battery level and notify me after the crtical level. and is there any way to identify a node that is joining and leaving a network using c ...

Where are core dumps written to in Mac OS X?

On Mac OS X, if I send SIGQUIT to my C program, it terminates, but there is no core dump file. Do you have to manually enable core dumps on Mac OS X (how?), or are they written to somewhere else instead of the working directory? ...

turning text into paginated two-column format and pipe this into less

I want to read a long text file in two-column format on my terminal. This means that the columns must be page-aware, so that text at the bottom of the first column continues at the top of the second column, but text at the bottom of the second column continues at the beginning of the first column after a page-down. I tried column and l...

BASH script to compare two directories & copy contents into a third directory?

Basically I'm trying to copy the contents of both dir1 and dir2 (excluding subdirectories) into dir3. The caveat is that if a file exists in both dir1 and dir2, I need to copy the newer file. Lets say the newer file exists in dir2. I had: find dir1 -type f -exec cp {} dir3 \; find dir2 -type f -exec cp -u {} dir3 \; Doing it this way...

dbx: No current source file , even after i compile with -g -xs , cant find source files

im using pathmap , to map the source and objects , compiled with -g -xs but still dbx can't find the source files what else can it be ? ...

How can I determine if a python script is executed from crontab?

I would like to know how can I determine if a python script is executed from crontab? I don't want a solution that will require adding a parameter because I want to be able to detect this even from an imported module (not the main script). ...

Unix Oracle / Perl driver problem

I have a script that is using DBI to interface with Oracle, but I keep getting the following error: install_driver(Oracle) failed: Can't load '/usr/opt/perl5/lib/site_perl/5.005/aix/auto/DBD/Oracle/Oracle.s o' for module DBD::Oracle: dlopen: /usr/opt/perl5/lib/site_perl/5.005/aix/auto/DBD/Oracle/Oracle.so: can't load libra...

Zend tool include path

Hello, Is it possible to install and use ZF (+ its console tool) without access to include_path direcotory? I've tried adding the ...Zend/library direcotry into include_path but without success. I did it this way: php -r 'set_include_path(get_include_path() . PATH_SEPARATOR . "/var/www/.../Zend/library")'; After var_dumping result o...

select part of filename using regex

I got a file that looks like dcdd62defb908e37ad037820f7 /sp/dir/su1/89/asga.gz 7d59319afca23b02f572a4034b /sp/dir/su2/89/sfdh.gz ee1d443b8a0cc27749f4b31e56 /sp/dir/su3/89/24.gz 33c02e311fd0a894f7f0f8aae4 /sp/dir/su4/89/dfad.gz 43f6cdce067f6794ec378c4e2a /sp/dir/su5/89/adf.gz 2f6c584116c567b0f26dfc8703 /sp/dir/su6/895/895.gz a864b7...

lynx to extract links from web site

how to extract links using lynx the links form anchor tags if there is a link in web i need to extract google.com ...

Exclude $0 when echoing the arguments of a command in a loop (BASH)?

I'm trying to use a for loop to get the filenames of files that end in .cpp. Code: for cppfile in ls *.cpp ; do echo $cppfile done I plan on doing more than just echoing the argument, but as it stands now, it works fine except that I'l get the command as the first arguement. Is there an easy way to avoid this, or will I have to do ...

UNIX Domain sockets vs Shared Memory (Mapped File)

Hi. Can anyone tell, how slow are the UNIX domain sockets, compared to Shared Memory (or the alternative memory-mapped file)? Thanks. ...

Need a good book to help me learn bash, solaris and unix in general.

Just started a new coop workterm and using a solaris machine with bash as my shell. Know basic commands in bash: ls, pwd, find, cd, mkdir, rm, grep ... That is basically all I need to do my job (working in java with intellij), but would like to be able to use my machine better. Can anybody recommend a book for me? Hopping for some l...

How to handle non-printable ASCII character parameters?

I'm working on a project where we are dealing with importing/exporting data from database tables using ksh scripts and Perl scripts. We have an existing process to export data from a table to a file and it is then imported into another system. Here's the catch - the export process dumps out pipe delimited files while the system that is...

Unix softlinks and paths

I am somewhat confused how soft links work in unix. See the example. % cd /usr/local/ % ls -la total 6 drwxr-xr-x 2 root root 512 Jan 19 15:03 . drwxr-xr-x 41 root sys 1024 Jan 20 16:24 .. lrwxrwxrwx 1 root root 38 Jan 19 15:03 java -> /otherDir/java/jdk1.6.0_17 **<- this is a soft link** % ...

Why is my Slave not starting on MYSQL?

mysql> start slave; Query OK, 0 rows affected, 1 warning (0.00 sec) mysql> show warnings; +-------+------+--------------------------+ | Level | Code | Message | +-------+------+--------------------------+ | Note | 1254 | Slave is already running | +-------+------+--------------------------+ 1 row in set (0.00 sec) mys...

question on linux command

What do the two ampersands in the following command do: (make foo&)& ...

"which in ruby": Checking if program exists in $PATH from ruby

Hiya, my scripts rely heavily on external programs and scripts. I need to be sure that a program I need to call exists. Manually, I'd check this using 'which' in the commandline. Is there an equivalent to File.exists? for things in $PATH? (yes I guess I could parse %x[which scriptINeedToRun] but that's not super elegant. Thanks! yann...

Vim updating currently viewed file

Im just curious if im viewing a file e.g. x.log which is currently being updated ie a log file. Is there a way to effectively refresh it rather than :q and vim x.log it again ? ...

unix shell script to remove blank lines following opening brackets

Hi all, I need a (sed, awk) shell script or, even better, a vim command to remove any blank lines following a line with a single opening curly bracket: void func() { foo(); } void bar() { helloWorld(); } should become: void func() { foo(); } void bar() { helloWorld(); } Any thoughts? ...