Tag Info

Hot answers tagged

65

You can send dd a certain signal using the kill command to make it output its current status. The signal is INFO on BSD systems (including OSX) and USR1 on Linux. In your case: kill -INFO $PID You can find the process id ($PID above) with the ps command; or see pgrep and pkill alternatives on mac os x for more convenient methods. More simply, as AntoineG ...


43

Most versions of Mac OS X since 10.5 have been certified as Unix by The Open Group: 10.9 (Mavericks) 10.8 (Mountain Lion) 10.6 (Snow Leopard) 10.5 (Leopard) OS X 10.7 (Lion) never was certified. I don't know why. (I checked Apple's page on The Open Group site periodically while OS X 10.7 was current, expecting to need to update this answer. Using the ...


40

In some sense, it is a UI convention with history that goes back all the way to 1984. Since Windows and X11 both post date the original Mac GUI, one might say that Windows does it the Windows way "just to be different" rather than suggesting that the Mac is the oddball. Back in the earliest days of the Macintosh, you could only run one application at a ...


38

The whole ABI is different, not just the binary format (Mach-O versus ELF) as sepp2k mentioned. For example, while both Linux and Darwin/XNU (the kernel of OS X) use sc on PowerPC and int 0x80/sysenter/syscall on x86 for syscall entry, there's not much more in common from there on. Darwin directs negative syscall numbers at the Mach microkernel and ...


37

I made the same move years ago. Here are the things I've run into: Your average desktop Linux has a richer userland than that of OS X. You'll probably miss different tools than I did, so no sense getting specific about recommendations for replacements. Instead, just install Fink, MacPorts, or Homebrew first thing. These systems provide a package ...


37

Using cat Since your file is short, you can use cat. cat filename Using less If you have to view the contents of a longer file, you can use a pager such as less. less filename You can make less behave like cat when invoked on small files and behave normally otherwise by passing it the -F and -X flags. less -FX filename I have an alias for less ...


32

It indicates the file has extended attributes. You can use the xattr command-line utility to view and modify them: xattr --list filename xattr --set propname propvalue filename xattr --delete propname filename


32

The history of MacOS is a little bit more convoluted. I was very interested in this in the late 90's as Mach had been pitched around the world as a faster way of building a Unix system. The origin of the kernel is a bit more complicated. It all starts with AT&T distributing their operating system to some universities for free. This Unix was ...


23

Three reasons: First, being certified as a Unix says nothing about your licensing, just your compliance to the established standards for being Unix. Second, because being Unix has nothing to do with your licensing, and everything to do with your being like Unix, an originally proprietary system, and one with a long legacy. Finally, don't mistake ...


22

On the Unix side, OS X is a descendant of NeXTSTEP, which was derived from 4.3BSD with the core parts of the kernel replaced with Mach. The NeXT programming API, which eventually came to be called OpenStep, is the basis of today's Cocoa API for OS X. Two APIs have diverged greatly since Apple bought NeXT in 1997, though there are ongoing efforts to provide ...


22

Terminal is a terminal emulator. It interprets various control sequences sent by programs (control characters like CR, LF, BS and longer control sequences for commands like “clear screen”, “move cursor up 3 lines”, etc.). Terminal is the same kind of program as xterm, rxvt, Konsole, or GNOME Terminal. Almost all modern terminal emulators support the “xterm” ...


21

The answer that suggested system_profiler | grep 'System Version' is what I have tried to use in the past, but it has 2 problems. It is slow since it generates a full system_profiler dump of the machine, gathering all hardware and software inventory information. The output of system_profiler has changed over time. e.g. output of grep for 'Serial Number' ...


21

MacOS: alias ll='ls -lG' Linux: alias ll='ls -l --color=auto' Stick that in ~/.bashrc.


20

HUGE GOTCHA -- Mac OS filesystem is NOT case sensitive.


18

bash actually remembers the times until you close the shell. So try running HISTTIMEFORMAT='%x %X ' history If you also put HISTTIMEFORMAT=<some format> in your ~/.bashrc, it will also get written to ~/.bash_history on exit, so you can check what happened in previous shell sessions too.


18

Bash itself will be mostly the same. There will be a few small differences but none of these will affect the portability of your scripts. The major problem is that the MacOS coreutils are FreeBSD-based while the utilities you are used to are most likely from the GNU project. The FreeBSD coreutils are not always compatible with the GNU coreutils. There are ...


16

UDF is a candidate. It works out-of-the-box on linux >= 2.6.31, Windows >= Vista, MacOS >= 9 and on many BSDs. Note: UDF comes in different versions, which are not equally supported on all platforms, see Wikipedia - Compatibility. UDF can be created on linux with the tool mkudffs from the package udftools.


16

You're seeing the escape sequences that tell the terminal to change colors displayed with the escape character shown as ESC, whereas the desired behavior would be that the escape sequences have their intended effect. Commands such as git diff and git log pipe their output into a pager, less by default. Git tries to tell less to allow control characters to ...


15

Keep the dotfiles as portable as possible and avoid OS dependent settings or switches that require a particular version of a tool, e.g. avoid GNU syntax if you don't use GNU software on all systems. You'll probably run into situations where it's desirable to use system specific settings. In that case use a switch statement with the individual settings: ...


14

OS X is the only remaining operating system based on the Mach microkernel which is also still commercially relevant. There are a few ongoing research projects and obsolescent OSes that no doubt are still being used in production settings on old machines, but nothing you can go out and buy on a new machine today. OS X has the usual assortment of kernel ...


14

Why OSX applications won't run natively on linux: First of all OSX uses a different binary format than Linux, so Linux can't execute binaries compiled for OSX (the same way it can't execute binaries compiled for Windows or BSD). Second of all, if you're talking about GUI applications, Apple's GUI toolkit Cocoa a) is only available for OSX and b) does not ...


14

It should be pointed out that Mac OS X uses \n a.k.a linefeed (0x0A) now, just like all other *nix systems. Only Mac OS versions 9 and older used \r (CR). Reference: Wikipedia on newlines.


14

Based on the error message that you get, I don't think /dev/urandom is the problem. If it were, I'd expect an error like "no such file or directory". I searched for the error message you got and found this, which seems like it might be relevant to your issue: http://nerdbynature.de/s9y/?176 Basically, specify the locale by prepending the tr command with ...


13

For dd, you can send a signal. For other commands that are reading or writing to a file, you can watch their position in the file with lsof. lsof -o -p1234 # where 1234 is the process ID of the command lsof -o /path/to/file If you plan in advance, pipe the data through pv.


13

Don't try to parse find output except as a last resort. It is important to realize that on Unix file systems, file names are not strings (a common misconception) but rather binary blobs which can contain any character except / and the null character. Parsing file names safely and correctly is enough of a pain that 99% of the time you'll just want to avoid ...


13

If you're using OS X's Terminal.app, it will capture Page up/down keypresses and just scroll the window contents, as if you used the scroll bar. You can use Shift+Page up/down to send them to the application inside the terminal. Using that, you should be able to scroll by a page at a time using: Control+B [ Arrows keys or Shift+Page up/down Control+C when ...


12

The behavior of shell utilities does differ in minor ways between unix variants. There are many unix variants, with a complex history. There are standardisation efforts such as the POSIX standard and its superset the Single UNIX specification. Most systems nowadays implement POSIX:2001, also known as the Single UNIX Specification version 3, with minor ...


12

I can answer only for Ubuntu. In Ubuntu the root user has a locked password. From passwd man page: -l, --lock Lock the password of the named account. This option disables a password by changing it to a value which matches no possible encrypted value (it adds a '!' at the beginning of the password). You can see the ! ...


12

Why not use rsync --progress [SRC] [DST] Do check the man rsync page because it has a lot of very useful options. -a for archive is a good start, but it depends on your exact requirements. Copying through a pipe will unnecessarily slow down the copy process, especially if it is files based.


12

This can be do the same thing with purge: sync && echo 3 > /proc/sys/vm/drop_caches From man proc: /proc/sys/vm/drop_caches (since Linux 2.6.16) Writing to this file causes the kernel to drop clean caches, dentries and inodes from memory, causing that memory to become free. To free ...



Only top voted, non community-wiki answers of a minimum length are eligible