Unix is a multitasking, multi-user computer operating system originally developed in 1969 by a group of AT&T; employees at Bell Labs.

learn more… | top users | synonyms

1
vote
0answers
10 views

Parsing GTF file using command-line

I am trying to extract exons details from a GTF file using command line in Unix like cut, awk, grep or sed. input file.gtf: ...
0
votes
1answer
32 views

Split a file into individually allocated lines

This is part of a larger project that is to run on POSIX systems. My concerns with it are the lack of comments, best practices with the filesystem, and naming things. Of course all feedback is great. ...
2
votes
1answer
20 views

GNU Makefile for google benchmark

I've decided to write a common Makefile for Google benchmark library. You could say I could have taken generated Makefile, but it's not appropriate solution (or maybe I'm wrong?). ...
2
votes
1answer
32 views

Shell script to archive files to AWS S3

This is a simple script that moves files to S3 if they are > 14 days old. It ignores files that are < 14 days old. If the file is successfully synced to AWS S3 then we can remove it from the server....
5
votes
1answer
16 views

Script to record an inventory of a backup

This is a script designed to make an inventory file which records the contents of a directory allowing verification that a backup has the same data. The same script can also A full github repo is ...
3
votes
1answer
58 views

C++ getaddrinfo()/addrinfo wrapper (rewrite)

As suggested by @Dannnno on my original post, I am posting my partially rewritten getaddrinfo() (and now addrinfo) wrapper for ...
6
votes
2answers
101 views

C++ getaddrinfo() wrapper

EDIT: New version can be found here: C++ getaddrinfo()/addrinfo wrapper (rewrite) I'm a C++ novice, but an experienced Python and C programmer. I decided to code a C++ wrapper around ...
2
votes
1answer
22 views

Shell command for the normal program termination of Skype from the command line

Would the following be the right way to do it in your opinion? Can you suggest a better alternative or, if not, is there something that can be done to make the existing version better? ...
5
votes
1answer
43 views

Automake for an S/KEY implementation

I've been tasked with giving a legacy codebase some love. The actual code is written in C, but is not very relevant aside from the #includes each file makes. No, ...
2
votes
1answer
54 views

C main function for POSIX shell

I got a pretty large main function that I want to break up in smaller helper functions. Can you help me suggest what to break out into helper functions? The ...
0
votes
1answer
28 views

Handle builtin commands

I've written a small C function to handle the builtin commands of a custom shell that I'm writing in C. Is it better to use a switch instead? ...
4
votes
4answers
782 views

Converting the DateTime to and from Unix epoch times

I'm currently working on a thing I needed this feature for. Essentially, these are two methods to convert DateTime objects to and from the Unix epoch time (two ...
3
votes
1answer
51 views

Display the last N lines of a text file with line numbers in reverse order

Do you think the way I'm doing it is fine? Is this the most typical way to do it? Share your thoughts please. ...
2
votes
0answers
113 views

A two-method program for running background jobs

Edit: since originally posting this I have: realized that it won't run from irb/pry, and refactored to remove some sleep calls. I've also separated the sections ...
4
votes
1answer
30 views

Making time lapse screenshots using Bash

My experience in bash is... well, around the Bourne shell on AIX. I wrote a semi-complex script in Bash, and I feel that it could be improved in 100 different ways. The Github project is here: https:/...
4
votes
2answers
84 views

Un*x terminal history wiper

Using various answers from Stack Overflow and Ask Ubuntu, I've hacked together this simple C program that wipes terminal history. It works but I'm relatively new to C so I'm not sure if everything is ...
1
vote
0answers
47 views

Measuring CPU frequency in *nix

I have this small function for reading the TSC (time-stamp counter) in *nix. Using it seems to report my CPU frequency more or less correctly. ...
1
vote
2answers
40 views

Program to let any user run a command

I have a script which can only be run by one specific user on a system. I need to let all users on the system have access to run that script and see the output. But there must never be more than one ...
4
votes
1answer
216 views

FFmpeg command line for showing two videos side by side

Here is command line for playing two videos side by side in sync in FFmpeg (ffplay). It can be useful for comaring videos, for example. ...
2
votes
0answers
66 views

Termios/Xterm line editor for APL interpreter

As an interesting sub-part of an interpreter -- just the Read part of the REPL -- I present my raw-mode line-oriented editor that I intend to use for my APL interpreter. (The Eval part has been posted ...
6
votes
2answers
52 views

An installer for shell scripts, written in pure sh

I wrote a tiny shell script that basically installs a script into your system by copying it to someplace like /usr/local/bin, chmodding it, and adding it to your ...
5
votes
1answer
37 views

Pseudoportable C script pattern - follow-up

See the initial/previous iteration. I have rewritten the script following the answer of @200_success. Now it looks like this: ...
5
votes
1answer
63 views

Pseudoportable C script pattern

(See the next iteration.) From time to time, while working with a command line in *nix family of operating systems, we have to write those scripts doing a rather specific task. Usually we use ...
1
vote
1answer
129 views

Enforce exclusive order of four processes using semaphores

I am on the learning curve of C and its capabilities. Below I have tried to create 4 individual programs where the execution is always in order (program 0,1,2,3). About the program Program #0 is ...
2
votes
2answers
39 views

Split redirecting to multiple files in bash

A function mycommand which runs command and: Gives me three log-files which are: *.stdout.log: everything from ...
4
votes
2answers
99 views

CGI script for managing Unix passwords

All the services I run on my server are based on Unix accounts. Since most web services have their own users and perform all the account management separate from the actual system accounts, I created ...
3
votes
2answers
275 views

WIFEXITED combined with WIFSIGNALED

I am testing the WIFEXITED to see if a child process exited abnormally or normally. According to documentation, it should return a non-zero status for a child ...
5
votes
2answers
86 views

Writing a utility class for converting between datetime and timestamp

I'm writing an Python application that uses frequently datetime and Unix timestamp. I know Python is 'batteries included', however, I found that converting between datetime and timestamp in Python 2.6 ...
1
vote
1answer
2k views

Non-blocking Unix domain socket

I've developed quickly two kinds of socket use: the first with blocking mode and the second with non-blocking mode. The sockets are Unix domain sockets. My problem is that the kernel consume a huge ...
2
votes
2answers
82 views

Set-uid root program that runs a program as the user “restrict” (follow-up)

See Set-uid root program that runs a program as the user "restrict" for context. I've written a very short program that is intended to run the program specified in its arguments (...
0
votes
1answer
34 views

Set-uid root program that runs a program as the user “restrict”

I've written a very short program that is intended to run the program specified in its arguments (argv) as the user named "restrict" (which exists). I want to make ...
7
votes
1answer
223 views

Portable method of getting time in C

Mac doesn't have the Unix clock_gettime so I am trying to create something that's really portable and only dependent on C. So far I've come across this function: <...
4
votes
3answers
101 views

Fetching filesystem directory listings on a server

I developed a server which takes a directory name then lists files in it and sends this list to a client. And I want that server to work with Telnet. It works but I have some questions on how I can ...
1
vote
1answer
51 views

Unix shell script with master and source files

I have a script which is having too many modules. The script is working perfectly, but the only issue is it is taking too much time and I need to reduce the complexity of the script. I have a source ...
4
votes
2answers
460 views

A simple fork with an ugly waitpid

This is my first take on fork, exec and waitpid. I didn't quite understand why I had to use ...
5
votes
1answer
286 views

A simple C++ trading system demo

I need my trading system demo reviewed. It implemented a simple system which parse the trading flow (logged in file) of different trader and calculate some important feature. packets.h ...
8
votes
1answer
611 views

A rapidly-growing script that visualizes WiFi sniffing

Below is one of the versions of my wifimap script: ...
3
votes
3answers
2k views

Unix shell function for adding directories to PATH

Adding a directory to the PATH in Unix/Linux is a very common task. However, what if the directory is already in the path? My goal is to write a shell function (...
2
votes
2answers
57 views

A trivial command line utility for trimming whitespace from lines in C - follow-up 3

The previous iteration at A trivial command line utility for trimming whitespace from lines in C - follow-up 2 Now my code looks like: ...
1
vote
1answer
60 views

A trivial command line utility for trimming whitespace from lines in C - follow-up 2

The previous iteration at A trivial command line utility for trimming whitespace from lines in C - follow-up Note: the next iteration at A trivial command line utility for trimming whitespace from ...
3
votes
2answers
63 views

A trivial command line utility for trimming whitespace from lines in C - follow-up

See the previous iteration: A trivial command line utility for trimming whitespace from lines in C Note: see the next iteration at A trivial command line utility for trimming whitespace from lines in ...
3
votes
1answer
68 views

A trivial command line utility for trimming whitespace from lines in C

I was practicing some C and decided to write this simple command line utility for stripping leading and trailing white-space characters. Note: see the next iteration at A trivial command line utility ...
1
vote
1answer
294 views

Python script that launches a process that it needs to clean up after and kill on receiving SIGTERM/SIGINT

I'm using a Python script to run a particular program that occasionally may need to be terminated (by receiving a SIGINT or SIGTERM) in which case a clean up process needs to be invoked (before ...
5
votes
3answers
50 views

Security feedback sought on Perl code running command on unsafe filename in Unix env

I'm looking for security feedback on the following fully functional code. The code is trying to safely use the Unix 'file' command to give details about the file. A hard link is used to create a ...
2
votes
1answer
180 views

HTTP client similar to cURL

I'm writing my own HTTP client, kinda like cURL. (I already know I'm reinventing the wheel, this is more or less getting an inside look of HTTP 1.x before 2 becomes a thing.) So far pages download ...
4
votes
1answer
236 views

C++ line-editing micro-library

Working on a project, I've taken to adapting the linenoise line editing library for my own use, among other things, rewriting it using C++. The idea is to separate my changes and updates into a new ...
5
votes
2answers
2k views

Function to grab stdin, stdout, stderr of a child process

I've managed to create a function to pipe the stdin, stdout and stderr of a child process ...
4
votes
1answer
113 views

Find-grep-sed for project-wide search & replace

I always forget how to do this efficiently with Vim's arglist. Drawing inspiration from a post over at Stack Overflow, I wrote a Bash function to perform a project-wide search & replace. It does ...
8
votes
2answers
2k views

MySQL class to add user/database

I'm creating tool to add new virtualhost on UNIX-box. One of tasks is to add a new user and database to MariaDB (aka MySQL) server. In fact - this my first 'real' attempt to use OOP. Here is class, ...
4
votes
1answer
91 views

Pathname matching and listing program

This Python 3 program outputs a list of all pathnames in the filesystem that match a list of rules taken from a file. You can add and remove sets of pathnames. The original purpose was to generate ...