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
22
votes
6 answers

unix:///tmp/supervisor.sock no such file

Using Ubuntu 16.04 LTS to deploy my python app. Configured everything and the app is running manually. I want to automate it with supervisor, I have installed supervisor and configured it. But if I run: Supervisor config file: ; supervisor config…
Joseph Daudi
  • 1,557
  • 3
  • 17
  • 33
22
votes
3 answers

Why does my tool output overwrite itself and how do I fix it?

The intent of this question is to be a canonical that covers all sorts of questions whose answer boils down to "you have DOS line endings being fed into a Unix tool". Anyone with a related question should find a clear explanation of why they were…
Ed Morton
  • 188,023
  • 17
  • 78
  • 185
22
votes
1 answer

Using chmod in a C program

I have a program where I need to set the permissions of a file (say /home/hello.t) using chmod and I have to read the permissions to be set from a file. For this I first read the permissions into a character array and then try to modify the…
Raghav
  • 229
  • 1
  • 2
  • 3
22
votes
7 answers

Change the ruby process name in top

I would like to change the name of the ruby process that gets displayed in the linux/unix top command. I have tried the $0='miname' approach but it only works with the ps command and in top the process keeps getting displayed as "ruby"
muesan
  • 373
  • 3
  • 8
22
votes
5 answers

egrep search for whitespace

I'm trying to use egrep with a regex pattern to match whitespace. I've used RegEx with Perl and C# before and they both support the pattern \s to search for whitespace. egrep (or at least the version I'm using) does not seem to support this…
user32474
  • 337
  • 3
  • 4
  • 8
22
votes
8 answers

How to find the mountpoint a file resides on?

For example, I've got a file with the following path: /media/my_mountpoint/path/to/file.txt I've got the whole path and want to get: /media/my_mountpoint How can I do this? Preferably in Python and without using external libraries / tools. (Both…
Georg Schölly
  • 124,188
  • 49
  • 220
  • 267
22
votes
9 answers

Using 'find' to return filenames without extension

I have a directory (with subdirectories), of which I want to find all files that have a ".ipynb" extension. But I want the 'find' command to just return me these filenames without the extension. I know the first part: find . -type f -iname…
Siavosh Mahboubian
  • 403
  • 1
  • 3
  • 6
22
votes
4 answers

"Variable $foo will not stay shared" Warning/Error in Perl While Calling Subroutine

Update3: If you like this posting please don't upvote me but upvote the genius answer by DVK below. I have the following subroutines: use warnings; #Input my @pairs = ( "fred bill", "hello bye", "hello fred", "foo bar", "fred…
neversaint
  • 60,904
  • 137
  • 310
  • 477
22
votes
9 answers

Bash read/write file descriptors -- seek to start of file

I tried to use the read/write file descriptor in bash so that I could delete the file that the file descriptor referred to afterward, as such: F=$(mktemp) exec 3<> "$F" rm -f "$F" echo "Hello world" >&3 cat <&3 but the cat command gives no output.…
telotortium
  • 3,383
  • 2
  • 23
  • 25
22
votes
2 answers

What is the best way to write a wrapper function that runs commands and logs their exit code

I currently use this function to wrap executing commands and logging their execution, and return code, and exiting in case of a non-zero return code. However this is problematic as apparently, it does double interpolation, making commands with…
Tom Feiner
  • 20,656
  • 20
  • 48
  • 51
22
votes
8 answers

Is there a standard way to make sure a python script will be interpreted by python2 and not python3?

Is there a standard way to make sure a python script will be interpreted by python2 and not python3? On my distro, I can use #!/usr/bin/env python2 as the shebang, but it seems not all distros ship "python2". I could explicitly call a specific…
static_rtti
  • 53,760
  • 47
  • 136
  • 192
22
votes
3 answers

Unix wildcard selectors? (Asterisks)

In Ryan Bates' Railscast about git, his .gitignore file contains the following line: tmp/**/* What is the purpose of using the double asterisks followed by an asterisk as such: **/*? Would using simply tmp/* instead of tmp/**/* not achieve the exact…
Yuval Karmi
  • 26,277
  • 39
  • 124
  • 175
22
votes
6 answers

sudo nohup nice <-- in what order?

So I have a script that I want to run as root, without hangup and nicely. What order should I put the commands in? sudo nohup nice foo.bash & or nohup nice sudo foo.bash & etc. I suspect it doesn't matter but would like some insight from those who…
Jonah Braun
  • 4,155
  • 7
  • 29
  • 31
22
votes
6 answers

Defining PATH_MAX for a filesystem?

I'm presently writing a filesystem. The statvfs (and even the statfs) structs contain a field specifying the maximum length of a name in that path. As PATH_MAX is defined in the pathconf manpage (getconf), this means it is defined on a per-directory…
Matt Joiner
  • 112,946
  • 110
  • 377
  • 526
22
votes
3 answers

How can I exclude a directory from ls command

Let say we have Scripts Test Test1 When we do ls it shows all the three directories but I need to exclude the test1. So I should get only Scripts Test What command should I use here to exclude a directory? Thanks in advance
Madhumitha
  • 297
  • 1
  • 2
  • 6