unix

how to convert datetime to unix timestamp in c?

the scenario is: I get datetime in format "YYYY-MM-DD HH:MM:SS" with libexif. To minimize the saving cost, I wanna convert the datetime to unix timestamp or alike which only cost 64bit or 32bit. Is there any explicit way with c? ...

Java / Ada Big Endian to Linux Little Endian problems.

I am an intern who has inherited a problem with a testing program at the place where I am working. After searching around on a little bit I can across a person with my exact same problem. After asking around a little bit here, i found out that the guy who posted this does actually still work here, and I am getting his help with this too,...

Unix permissions from Windows

Hi all, I have a D-Link DNS-323 NAS, running some sort of Linux as its OS. I map a volume as a share in Windows Vista (Ultimate SP2). There are some directories and files on that share that I cannot change/delete - no matter what I try. Trying all of Windows security/permissions dialogs don't work, as the files owner is "Unix/root" and a...

transforming patch strip level

Suppose I have a patch that can be applied with -p0, is there a tool to automatically transform this patch into a -p1 patch. For example, transforming Index: stdio-common/_i18n_number.h =================================================================== --- stdio-common/_i18n_number.h (revision 8348) +++ stdio-common/_i18n_number.h (wor...

In linux: writing into a FIFO

I created a new FIFO using the 'mkfifo' command. I have a text file f.txt. I want to write the text file into my FIFO. How? Is there a unix command for that? ...

Programatically getting UID and GID from username in Unix?

I'm trying to use setuid() and setgid() to set the respective id's of a program to drop privileges down from root, but to use them I need to know the uid and gid of the user I want to change to. Is there a system call to do this? I don't want to hardcode it or parse from /etc/passwd . Also I'd like to do this programatically rather tha...

Ping from Dynamic Language without using 'ping'

I'm on a Linux system where I am not allowed to use the 'ping' application (ping: icmp open socket: Operation not permitted). However, the script that I am writing (PHP, but I can use an exec() call to any script/program if needed) needs to determine if a host is 'alive'. How can I go about this without using 'ping'? ...

unix system call monitor

how to monitor system calls for a process? ...

Running UNIX commands as different user, from Java

Trying to write a Java program capable of running a UNIX command as a different UNIX user. I have the user's password, and I know the command I want to run, but the command has to be run as that user - so I have to login as that user first. For example: say we have a user, jim, who wants to see what's in bob's home directory, and (for w...

What are the well-known UIDs?

According to the useradd manpage, UIDs below 1000 are typically reserved for system accounts. I'm developing a service that will run as its own user. I know that well-known ports can be found in /etc/services. Is there a place where I can find out what well-known UIDs are out there? I would like to avoid crashing with someone else's UI...

Is there a way to make PrintWriter output to UNIX format?

In Java, of course. I'm writing a program and running it under a Windows environment, but I need the output (.csv) to be done in Unix format. Any easy solution? Thanks! ...

ASH variable indirect reference

I'm trying to port a script from BASH to ASH (Almquist SHell) and am running into a problem with indirect references. The following function cmd() { # first argument is the index to print (ie label) arg=$1 # ditch the first argument shift # print the label (via indirect reference) echo "${!arg}" } should produc...

Tab Complete with KSH in emacs Mode without bindings

Hi, I'm trying to enable auto complete for the command line in emacs mode. When I try: set -o emacs bind '^I'=complete bind '^I'=complete-list and relog on, I get "bind command not found" error. Is there any other way to tab-autocomplete in emacs mode, i.e. a tab completes to the first difference? If not, how do I install bind...

Unix command to find string set intersections or outliers?

Is there a UNIX command on par with sort | uniq to find string set intersections or "outliers". An example application: I have a list of html templates, some of them have {% load i18n %} string inside, others don't. I want to know which files don't. edit: grep -L solves above problem. How about this: file1: mom dad bob file2:...

Full command text with unix ps

When we enter: ps -f ... the CMD column text doesn't show the full command. Any way to prevent this truncating? Seems like it's showing the first 80 characters. We are running a fairly log command that has lots of command line switches. Thanks for the responses.. doesn't seem like any of these do the trick though.. ...

Using ls to list directories and their total sizes

Is it possible to use ls in Unix to list the total size of a sub-directory and all its contents as opposed to the usual 4K that (I assume) is just the directory file itself? I.E. total 12K drwxrwxr-x 6 *** *** 4.0K 2009-06-19 10:10 branches drwxrwxr-x 13 *** *** 4.0K 2009-06-19 10:52 tags drwxrwxr-x 16 *** *** 4.0K 2009-06-19 10:02 tr...

Location of ini/config files in linux/unix?

Two questions, really: (1) Is there a standard/convention regarding the placement on configuration files? For system or quasi-system programs they seem to usually be somewhere in /ect. It seems less clear for plain application programs or pgms that with insufficient privileges for /etc. (2) There are multiple ways to provide informat...

How do i disable openbase_dir restrictions over HTTPS?

I'm trying to enable a php file to access another file residing in a folder outside the root web directory over an HTTPS connection. This works fine over HTTP but for some reason HTTPS connections are failing to read the file. I've enabled this over HTTP by disabling openbase_dir in a vhost.conf file, as follows: php_admin_value open_...

Unix 'find' + 'grep' syntax vs. awk

I was using this line to find the phrase, 'B206' within files in the directory I was in and all of its sub directories. find . -exec grep -s "B206" '{}' \; -print It crashes when it tries to read certain files and actually changes the title bar in putty to a bunch of weird characters For example, it crashes all the time when it hits ...

Is there some Unix util that will allow me to grep multiple files with little typing?

Right now I do this a lot: find * | grep py$ | xargs grep foo I recall there is some util that does this with way less typing, but which? UPDATE: I prefer to use the Bash shell if possible. ...