linux

Redirect script output to log file OR terminal by request

I'm writing a bash script that I want by default to output everything into a log file. However, I also want the ability to output it to the calling terminal by request (e.g. parameter) INSTEAD of the log file (so tee is out I believe). Does anyone know of a simple way to do this? It would be nice if the parameter could be a custom log...

How to change the time cron.daily is run in linux

I have a script in cron.daily that runs at a certain time every morning. I need to change the time that it is run. How do I change the time cron.daily runs the scripts? ...

Implement CPU extensions in a kernel module

Hi all, I'm looking for information relating to implementing certain CPU extensions in a kernel module. I've found something related: http://www.mirrors.docunext.com/lxr/http/source/arch/mips/kernel/unaligned.c in fact, it's the only source code that I can find that is even close. Basically, I have a binary only shared object built wit...

Advanced pgrep-like process search in bash

I need to find the pid of a certain java process in bash on linux. If there's only one java process, PID=$(pgrep java) works. For multiple java processes it becomes more complicated. Manually, I run pstree, find the ancestor of the java process that I need first, then find the java process in question. Is it possible to do this in b...

use linux shell script in window cygwin.

Hello: I have a shell script written in lunix environment. I am using clearcase as my source control. I also map the clearcase view in linux to my window xp network drive. I can go to the view by "cd /cygdrive/drive_letter". But how can I use the shell script from liunx in Cygwin on windows? I try to add the location of the shell script...

Removing Parts of String That Contain Digit With Sed/Perl (one-liner)

I have a data that looks like this: AB208804_1 446 576 AB208804_1orf 0 AB208804_20 446 576 AB208804_20orf 0 I want to convert them into this: AB208804 446 576 AB208804orf 0 AB208804 446 576 AB208804orf 0 just by removing _\digit part in column 1 and 4. Why this line doesn't work: sed 's/_\d+//g' What's the correct way to do it...

Using grep/find combination to find the usages of a function or a struct

I am wondering how I can effectively find the usages of a function/structure in the files using find & grep combination. For example, I have source code for git on my machine. If you look at the commit.h, you can see commit structure is defined like, struct commit { struct object object; void *util; unsigned int indegree; ...

Getting rid of file-based communication

I have to work with two C programs that communicate via a file-based interface. That is, each of them has a main loop where it polls three or four files (fopen, fscanf), reacts to what it reads and eventually makes its own changes to the files (fprintf) for the other process to read. Now I have to condense these two programs into a sing...

System call to get serial number of machine in linux (programmed in java)

I know this is a long shot but is there any way of getting the serial number or uniquely identifiable piece of information in linux? If so how can this be programmed into a Java program? In context, I need to build a license validator that locks down to one machine, if you have any other suggestions they are welcome. Thanks in advanc...

How to run a command without sudo?

Hello, I want to add a line in the crontab (on my local machine) which will run every five minutes. My problem is the command I am going to use requires sudo : sudo indexer --config /usr/local/etc/sphinx.conf --all --rotate Is there a way I can run the command without using sudo and without prompting for password ? Thanks! ...

how to work with ipv6 on net-snmp 5.5 on linux

Hi everyone! Can anybody tell me does linux snmp agent support ipv6.I am working with net-snmp 5.5. Its working fine with ipv4 address set and get operations but with ipv6 address leads to unknown host. Can anybody help me locate what the problem is and how to resolve it. Thanx in advance ...

Linux command to get dhcp servers on lan

I want to know if there is any command line utility tool which will allows me to get the ip of the DHCP servers on LAN. ...

Javascript interpreter for Linux

Is there a way to run linux commands from javascript that uses a standalone interpreter (something similar with SpiderMonkey, JavaScript shell)? ...

Howto debug program that needs to run as root from gdb (Eclipse) as user (set gdb suid root?)

I need to debug a program on Linux with Eclipse (gdb). The program run as root and is quite large. The binary with debug symbols is about 250MB large and has more than 60 running threads after startup. I'm thinking about the best solution: Use gdbserver Run Eclipse as root Set gdb suid I think number 1 (gdbserver) would be the bes...

possible to make tunneling using linux webhosting with cpanel

hi, I'm having a Linux Webhosting account with cpanel & whm.. i also see something ssh on cpanel.. i have heard about tunneling to make proxy. my friend is having VPS server and is able to make tunneling using ssh via 443port. i need to know if there is some possibility to make proxy browsing using my webhosting account.. i google...

I want to receive data CONTINUOUSLY from a COM port & simultaneously want to write to file

I want to read serial COM port and to write the data to a file in LINUX. Actually I'm sending data from hyperterminal from other PC. The problem is without while loop I can write only one line. But with while(1) loop I can't write anything to file. Or else I have to send BIG file, then application exits/terminates and writes to the fi...

Python os.system() - does it leave history (bash_history,etc.) ?

Hello, I'm using os.system() to invoke some openssl command from my ubuntu box. I specify password in line so it looks like: //python code os.system("openssl enc -aes-256-cbc ... -k password") I need to know if is possible to track this command in some shell / bash history file (as it is possible if I type this command into terminal ...

coreadm solaris command equvalent in linux?

Hi, what is the equivalent of coreadm solaris command in linux ...

How stop to going to new line in Shell script

For Ex : echo "adsa " >> a.txt echo "asdad " >> a.txt in my file adsa asdad But i am looking for adsa asdad ...

alias in a script

In linux, if I put a command in a script that contains an alias, I see that it doesn't get expanded. How can I fix that? I am using bash. ...