Questions tagged [bsd]

BSD is a family of Unix-like operating systems, including FreeBSD, NetBSD and OpenBSD.

510 questions
7
votes
6 answers

Combine lines with matching first field

For a few years, I often have a need to combine lines of (sorted) text with a matching first field, and I never found an elegant (i.e. one-liner unix command line) way to do it. What I want is similar to what's possible with the unix join command,…
Michael Douma
  • 1,144
  • 8
  • 21
7
votes
1 answer

How to create an empty tgz file?

How to create an empty tgz file? I tried tar czvf /tmp/empty.tgz --from-file /dev/null tar: Option --from-file is not supported
american-ninja-warrior
  • 7,397
  • 11
  • 46
  • 80
7
votes
2 answers

What is the effect of changing system time on sleeping threads?

If you take a look at the clock_gettime() function, which is available in all BSDs and is actually defined as part of the POSIX standard, you see that there is support for at least three types of clocks (many systems support more than these clocks,…
Mecki
  • 125,244
  • 33
  • 244
  • 253
7
votes
4 answers

Use OpenBSD's malloc, realloc and free in my program

I would like to use OpenBSD's implementation of malloc, realloc and free on my Debian lenny desktop rather than glibc's. Are they simply drop in replacements: will they work on my Linux desktop ? Which are the file(s) that I need and which OpenBSD…
Neeladri Vishweswaran
  • 1,695
  • 5
  • 22
  • 40
7
votes
4 answers

Should I include any or all of the headers listed in the synopsis of a man page?

For example, take open(2), which has the following synopsis: #include #include #include int open(const char *pathname, int flags); int open(const char *pathname, int flags, mode_t mode); int creat(const char…
user1804599
7
votes
1 answer

OS requirements for arc4random_uniform()

How do I find out the minimum OS requirements for using arc4random_uniform()? Is it defined in BSD? If so, from what version? Does it run on any Mac OS X version? How about iOS versions? Is there any official place I can find these things out?
rid
  • 61,078
  • 31
  • 152
  • 193
6
votes
2 answers

UDP broadcast using CFSocket on IOS

Have been doing some google search and some reading on this subject but cannot seem to get it right no matter how much time i spent searching. What i want to do is to receive broadcast message of devices that are connected on my network by…
Alyek
  • 135
  • 1
  • 11
6
votes
3 answers

In which situations is it advisable to opt for BSD systems instead of Linux?

For an everyday-user with new hardware Linux seems for me the natural choice if somebody is looking for an alternative to Windows. But when does it make sense to give the BSD variants a try?
prinzdezibel
  • 11,029
  • 17
  • 55
  • 62
6
votes
1 answer

Sed delete first line from files

I want to remove the first line of all files in a folder if the file starts with uuid and so I have a working sed command looking like this: $ sed -i '' '/^uuid/d' * which works fine and removes all lines starting with uuid. Now I want to improve…
ola
  • 448
  • 5
  • 11
6
votes
2 answers

Bash printf literal verbatim string

To make my code portable, I try to use printf rather than echo. But then printf "-dogs-cats" returns an error. A workaround in the present case is: printf "-";printf "dogs-cats" But is there a general, portable command (or an option with printf)…
Jacob Wegelin
  • 1,304
  • 11
  • 16
6
votes
2 answers

Calculating percentages in arbitrary number of columns

Given this sample input: ID Sample1 Sample2 Sample3 One 10 0 5 Two 3 6 8 Three 3 4 7 I needed to produce this output using AWK: ID Sample1 Sample2…
janos
  • 120,954
  • 29
  • 226
  • 236
6
votes
3 answers

How can I determine my csh version?

I have some code which works for me, but when I gave it to some colleagues, it broke. They're using tcsh whereas, as far as I can figure, I'm using csh. I've tried: csh -v csh --version csh -V csh --help csh -h with no success (they all just take…
mgilson
  • 300,191
  • 65
  • 633
  • 696
6
votes
4 answers

BSD md5 vs GNU md5sum output format?

Any one knows why BSD md5 program produces hash output in this format ... MD5 (checksum.md5) = 9eb7a54d24dbf6a2eb9f7ce7a1853cd0 ... while GNU md5sum produces much more sensible format like this? 9eb7a54d24dbf6a2eb9f7ce7a1853cd0 checksum.md5 As far…
Rio
6
votes
2 answers

How can I know which architecture an *.a file is built for?

I'm working on mac OS 10.7.4. using Xcode 4.3.2 . I had a *.a static library file from my partner. I want to know which architecture it is built for. Is it ARMv6, ARMv7, i386 or other architecture? Is there any command or method to get info about…
qiushuitian
  • 1,261
  • 4
  • 19
  • 31
5
votes
1 answer

Explanation of difference between GNU sed and BSD sed

I wrote the following command echo -en 'uno\ndue\n' | sed -E 's/^.*(uno|$)/\1/' expecting the following output uno This is indeed the case with my GNU Sed 4.8. However, I've verified that BSD Sed outputs Why is that the case?
Enlico
  • 23,259
  • 6
  • 48
  • 102