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

How to choose which version of python runs from terminal?

I have a few different versions of python on my computer. How do I choose which one is run from my terminal when I type python into the prompt?
mjmostachetti
  • 378
  • 1
  • 4
  • 14
22
votes
4 answers

Get a range of lines from a file given the start and end line numbers

I need to extract a set number of lines from a file given the start line number and end line number. How could I quickly do this under unix (it's actually Solaris so gnu flavour isn't available). Thx
ScaryAardvark
  • 2,855
  • 4
  • 30
  • 43
22
votes
2 answers

Rails bundle - bad interpreter

I've been working on a rails project in sublime text and switched to rubymine. It said that some gems, which are required in the project, are not installed. Well, I tried to install them, but it fails with an error saying that the used ruby version…
Linus
  • 4,643
  • 8
  • 49
  • 74
22
votes
3 answers

diff'ing diffs with diff?

I need to know if the two patches are effectively the same. I have an old patch file and new patch file created with the unix diff command. Just diff'ing the patches reports differences due to the timestamp when the patch was created. Is there a…
srking
  • 4,512
  • 1
  • 30
  • 46
22
votes
7 answers

Cut from column to end of line

I'm having a bit of an issue cutting the output up from egrep. I have output like: From: First Last From: First Last From: First Last I want to cut out the "From: " (essentially leaving the "First Last"). I tried cut -d ":" -f 7 but the output is…
KyleCrowley
  • 900
  • 6
  • 14
  • 31
22
votes
6 answers

Is the Unix Philosophy falling out of favor in the Ruby community?

David Korn, a proponent of the Unix philosophy, chided Perl programmers a few years ago in a Slashdot interview for writing monolithic Perl scripts without making use of the Unix toolkit through pipes, redirection, etc. "Unix is not just an…
dan
  • 43,914
  • 47
  • 153
  • 254
22
votes
1 answer

new line separator for each grep result sh script

Is there a way to have each result of grep followed by newline for example if the result of grep is: 1 2 3 I need it to be: 1 2 3
Ggdw
  • 2,509
  • 5
  • 24
  • 22
22
votes
2 answers

tar/gzip excluding certain files

I have a directory with many sub-directories. In some of those sub-directories I have files with *.asc extension and some with *.xdr. I want to create a SINGLE tarball/gzip file which maintains the directory structure but excludes all files with…
user1654183
  • 4,375
  • 6
  • 26
  • 33
22
votes
4 answers

mutt command with multiple attachments in single mail unix

My requirement is to attach all the .csv files in a folder and send them in a single mail. Here is what have tried, mutt -s "subject" -a *.csv -- abc@gmail.com < subject.txt The above command is not working (It's not recognizing multiple files) and…
Mariappan Subramanian
  • 9,527
  • 8
  • 32
  • 33
22
votes
4 answers

git difference on parameter one dash and two dashes

in git when I specify a parameter, ie git log -n 5 what is the difference of using a parameter with one dash "-" as opposed to two dashes "--" git log --author="Larvae"
manuelBetancurt
  • 15,428
  • 33
  • 118
  • 216
22
votes
1 answer

Using the grep and cut delimiter command (in bash shell scripting UNIX) - and kind of "reversing" it?

So I have a file with the text: puddle2_1557936:/home/rogers.williams/folderz/puddle2 I want to use the grep command grep puddle2_1557936 Mixed in with the cut command (or another command if neccessary) to display just this…
DeaIss
  • 2,525
  • 7
  • 27
  • 37
22
votes
2 answers

How do i diff two files from the web

I want to see the differences of 2 files that not in the local filesystem but on the web. So, i think if have to use diff, curl and some kind of piping. Something like curl http://to.my/file/one.js http://to.my/file.two.js | diff but it doesn't…
poolsideDev
  • 390
  • 4
  • 13
22
votes
4 answers

How do I use Head and Tail to print specific lines of a file

I want to say output lines 5 - 10 of a file, as arguments passed in. How could I use head and tail to do this? where firstline = $2 and lastline = $3 and filename = $1. Running it should look like this: ./lines.sh filename firstline lastline
user2232423
22
votes
6 answers

Giving a file/directory the same modification date as another

How do I "copy" the modification date and time from one file/dir to another in Unix-based systems?
user2015453
  • 4,844
  • 5
  • 25
  • 27
22
votes
7 answers

Handling command line flags in C/C++

I am looking for a very simple explanation/tutorial on what flags are. I understand that flags work indicate a command what to do. For example: rm -Rf test I know that the rm command will remove the test folder and that the -Rf flags will force the…
Fabio Gomez
  • 687
  • 2
  • 7
  • 13