Questions tagged [unix]

NOTICE: All Unix questions must be related to programming; those that aren't will be closed. Use this tag only if your question relates to programming using Unix APIs or Unix-specific behavior, not just because you happen to run your code on Unix. General software issues should be directed to Unix & Linux Stack Exchange or to Super User.

Tag usage

The tag can be used for Unix system programming related problems. The tag can also contain programming questions about using the Unix platform. For non-programming Unix usage questions, visit the Unix & Linux Stack Exchange site.

Background

Unix was developed as an in-house operating system for AT&T, but in the 1980s became both a prime academic operating system (with U.C. Berkeley's version, called BSD, being the reference platform for development of what would become the Internet) and a commercial success in the form of AT&T's System V, Microsoft/SCO's XENIX (PCs) and various workstation versions from Sun, Silicon Graphics, and others.

In the 1990s, Sun's Solaris and the free Unix clone Linux would rise in popularity. Linux is largely Unix-compatible but lacks the trademark. Currently, Unix is commonly found on server platforms; the primary desktop variant is Mac OS X, based on BSD.

Apart from its command-line interface, most "Unices" support the standardized X Window System for GUIs. (So does Mac OS X, but its primary GUI is Apple's proprietary Quartz.)

The various Unix implementation (and to a lesser extent, clones such as Linux) are unified in a standard called POSIX. C has been its primary programming language since the 1970s, but many other languages are available.

Read more

47509 questions
20
votes
8 answers

Finding the longest word in a text file

I am trying to make a a simple script of finding the largest word and its number/length in a text file using bash. I know when I use awk its simple and straight forward but I want to try and use this method...lets say I know if a=wmememememe and if…
Mildred Shimz
  • 607
  • 4
  • 11
  • 20
20
votes
4 answers

Input bar at console bottom in C

Window bottom Some applications like vim, mutt, aptitude contain a top window section for output and a bottom section for the user to type in or for status display. (Suppose there is one child process to output and another one to take user…
user649198
20
votes
5 answers

Diff command to compare files on different servers--Unix

Can I use the diff command to compare files on two different servers? If not, is there any other option?
Anusha Pachunuri
  • 1,389
  • 4
  • 18
  • 39
20
votes
7 answers

Unix: How can I prepend output to a file?

Specifically, I'm using a combination of >> and tee in a custom alias to store new Homebrew updates in a text file, as well as output on screen: alias bu="echo `date "+%Y-%m-%d at %H:%M"` \ >> ~/Documents/Homebrew\ Updates.txt && \ brew…
Henrik
  • 2,421
  • 4
  • 25
  • 33
20
votes
6 answers

search and replace string on multiple files from unix terminal

We are converting all the static html pages in our codebase into php pages. The first step would be to change all the .html file extension to .php (which I already did). The second step would be to update all the links within each of those html…
Benny Tjia
  • 4,853
  • 10
  • 39
  • 48
20
votes
1 answer

If close(2) fails with EIO, will the file descriptor still be deleted?

If a close(2) system call fails with EIO, will the file descriptor still be deleted? If yes, is it not possible to handle a spurious IO error by retrying later? If no, how should one prevent a file descriptor leak?
fornwall
  • 2,877
  • 3
  • 25
  • 38
20
votes
4 answers

Debian $PATH variable change

How can I change the $PATH variable in Debian? I tried to change /etc/profile but this affected only normal users (and yes, I added path to BOTH user's and root's paths). After that I tried to edit /root/.profile and then /root/.bashrc also…
grongor
  • 1,305
  • 1
  • 13
  • 26
20
votes
2 answers

Macro `__unix__` not defined in MacOS X

I noticed that in MacOS X (Lion), the macro __unix__ is not defined. Since MacOS has its roots in BSD UNIX, shouldn't that be the case? Is it possible to let the compiler/preprocessor know that I want it to be considered a UNIX system?
Pietro
  • 12,086
  • 26
  • 100
  • 193
20
votes
8 answers

C++: how to get fprintf results as a std::string w/o sprintf

I am working with an open-source UNIX tool that is implemented in C++, and I need to change some code to get it to do what I want. I would like to make the smallest possible change in hopes of getting my patch accepted upstream. Solutions that are…
underspecified
  • 979
  • 1
  • 7
  • 15
20
votes
7 answers

Shell: list directories ordered by file count (including in subdirectories)

I've nearly reached my limit for the permitted number of files in my Linux home directory, and I'm curious about where all the files are. In any directory I can use for example find . -type f | wc -l to show a count of how many files are in that…
Richard Inglis
  • 5,888
  • 2
  • 33
  • 37
20
votes
3 answers

Interprocess communication with a Daemon

I want to implement a Unix daemon (let's call it myUnixd), and want the user to be able to interact with this daemon via the command line, for example: myUnixd --help # will display help information myUnixd --show # will show some data (the's deamon…
funnyCoder
  • 787
  • 2
  • 10
  • 30
20
votes
8 answers

What's the deal with the banner command?

In some versions of UNIX and Linux there's a banner command (usually /usr/bin/banner) that prints great output like this: ##### ####### # ##### # # # # # # # # # # # # # # # # # # ##### # …
SO Stinks
  • 3,258
  • 4
  • 32
  • 37
20
votes
4 answers

Prevent FIFO from closing / reuse closed FIFO

Consider the following scenario: a FIFO named test is created. In one terminal window (A) I run cat test. It is now possible to write in window B and get the output in window A. It is also possible to terminate the…
Shump
  • 454
  • 1
  • 4
  • 11
20
votes
3 answers

Can I get UTC offset from Unix command line?

I'm writing an autoconf script that needs the current UTC offset. There's no obvious way to get this out of the date program. Is there any straightforward way to get this from a command-line utility, or should I write a test that gets the…
vy32
  • 28,461
  • 37
  • 122
  • 246
20
votes
4 answers

Installing pythonstartup file

How do I install the pythonstartup file so that it runs on command like python myfile.py? I tried to install it into my /home/myuser directory for Ubuntu, but it said that I had insufficient permissions. Furthermore, different places say…
Celeritatis
  • 201
  • 1
  • 2
  • 3