unix

Validating SSH Credentials in Java on Unix

I have a text file on a unix machine containing the SSH user name and password that someone might use to connect to it. How do I verify that the user name and password are valid using Java? Do I try to SSH connect to the same machine by using Runtime.exec()? I can grep for the user /etc/passwd. But, the password is shadowed. I'd a...

How do I programatically take a screenshot of an application in Linux?

Hi, How do I programatically take a screenshot of an application in Linux? I'm using c++. Any idea? For windows there are a lot of resources but I can't find anything for linux Any help? Thanks ...

Creating Library with backward compatible ABI that uses Boost.

I'm working on certain C++ library (or more framework). I want to make it backward compatible with previous versions preserving not only API compatibility but also ABI (like the great job Qt does). I use lots of functionality of Boost and it seems for me that this makes backward compatibility just impossible, unless I force user to have...

how to edit binary file on the unix systems.

On windows machine there are lots of third party editors available to edit a binary file. I belive there should be some thing similer buildin in the *nix systems as well. any idea how can i edit a binary file on unix? ...

SSH Windows to UNIX

I built a batch file from my windows machine that connects to a UNIX server. I Then want commands to execute in UNIX from the batch file. UNIX doesn't seem to recognize my commands after I am logged into the server. This is what I coded: ssh SERVERNAME exit Right now, I am just trying to make it log in and exit. I get logged into the s...

How do I split a log file with an offset value in unix?

Hi, I have a really big log file (9GB -- I know I need to fix that) on my box. I need to split into chunks so I can upload it to amazon S3 for backup. S3 has a max file size of 5GB. So I would like to split this into several chunks and then upload each one. Here is the catch, I only have 5GB on my server free so I can't just do a simp...

Is it worth picking up Unix skills?

I mean this as a serious question. I have a chance at accepting a job offer with a company requiring skills in Unix (although they seem fine with my admittance of having only Windows experience, expecting me to be able to pick up Unix with the job). Java is multi-platform. Every piece of software I've ever had to use is available on...

unix regex for adding contents in a file

i have contents in a file like asdfb ... 1 adfsdf ... 2 sdfdf .. 3 I want to write a unix command that should be able to add 1 + 2 + 3 and give the result as 6 From what I am aware grep and awk would be handy, any pointers would help. ...

How to ignore hidden files with opendir and readdir in C library

Here is some simple code: DIR* pd = opendir(xxxx); struct dirent *cur; while (cur = readdir(pd)) puts(cur->d_name); What I get is kind of messy: including dot (.), dot-dot (..) and file names that end with ~. I want to do exactly the same thing as the command ls. How do I fix this, please? ...

How do I untar a subdirectory into the current directory?

How to I extract a subdirectory in a tarball into the current directory? Example, the tarball from wordpress: wordpress/ wordpress/wp-trackback.php wordpress/wp-config-sample.php wordpress/wp-settings.php wordpress/wp-rss2.php wordpress/readme.html wordpress/index.php ... How do I extract everything under wordpress/ into the current ...

How do I find my computer's IP address using the bash shell?

Every now and again, I need to start the Django development server, and have it viewable by other machines on my network, as described here: http://docs.djangoproject.com/en/dev/ref/django-admin/#runserver My machine’s IP address tends to change every now and again, so I’d like to have a little shell alias or something that spits out t...

wc gzipped files?

I have a directory with both uncompressed and gzipped files and want to run wc -l on this directory. wc will provide a line count value for the compressed files which is not accurate (since it seems to count newlines in the gzipped version of the file). Is there a way to create a zwc script similar to zgrep that will detected the gzipped...

To check whether script is running for every 5 mins

Hi, we have scheduled one script to run for every 5 mins. how we can check that whether the script is running for every 5 minutes in linux? If anyone knows, please Reply.. Thanks in Advance. We have created the script. But we dont run that script. Our Support team will run this for every minutes. If they found any error, then they w...

batch rename to change only single character

How to rename all the files in one directory to new name using the command mv. Directory have 1000s of files and requirement is to change the last character of each file name to some specific char. Example: files are abc.txt asdf.txt zxc.txt ... ab_.txt asd.txt it should change to ab_.txt asd_.txt zx_.txt ... ab_.txt as_.txt ...

Shell Script - Get all files modified after <date>

I'd rather not do this in PHP so I'm hoping a someone decent at shell scripting can help. I need a script that runs through directory recursively and finds all files with last modified date is greater than some date. Then, it will tar and zip the file(s) keeping the path information. Thanks in advance! ...

Finding very similar program executions.

Hi, I was wondering if its possible / anyone knows any tools out there to compare the execution of two related programs (for example, assignments on a class) to see how similar they are. For example, not to compare the names of functions, but how they use syscalls. One silly case of this would be testing if a C string is printed as (see...

Can the find command's "exec" feature start a program in the background?

I would like to do something like: find . -iname "*Advanced*Linux*Program*" -exec kpdf {} & \; Possible? Some other comparable method available? ...

How to remove/delete executable files (aka files without extension) only

I have a directory src/ that contain many .cc files and its binary. For example: src/ |_ foo.cc |_ bar.cc |_ qux.cc |_ thehead.hh |_ foo (executable/binary) |_ bar (executable/binary) |_ qux (executable/binary) |_ makefile In reality there are many .cc and executable files. I need to remove those binaries in a glob...

Printing hard copies of code

I have to hand in a software project that requires either a paper or .pdf copy of all the code included. One solution I have considered is grouping classes by context and doing a cat *.extension > out.txt to provide all the code, then by catting the final text files I should have a single text file that has classes grouped by context. T...

Is it possible to use a string as a delimiter in unix cut command?

Hi, If I want to cut a list of text using a string as a delimiter, is that possible. For e.g. I have a directory where a list of shell scripts call same perl script say abc.pl So when I do $grep abc.pl * in that directory, it gives me following results xyz.sh: abc.pl 1 2 xyz2.sh: abc.pl 2 mno.sh: abc.pl 3 pqr.sh: abc.pl 4 5 I basicall...