Tag Info

Hot answers tagged

81

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 ...


64

From your other questions I take it you're using OS X. The default HFS+ filesystem on OS X is case-insensitive: you can't have two files called "abc" and "ABC" in the same directory, and trying to access either name will get to the same file. The same thing can happen under Cygwin, or with case-insensitive filesystems (like FAT32 or ciopfs) anywhere. ...


61

It isn't a shebang, it is just a script that gets run by the default shell. The shell executes the first line //usr/bin/env go run $0 $@ ; exit which causes go to be invoked with the name of this file, so the result is that this file is run as a go script and then the shell exits without looking at the rest of the file. But why start with // instead of ...


51

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 ...


48

Mac OS X has been certified as Unix by The Open Group from 10.5 onward: 10.10 (Yosemite) 10.9 (Mavericks) 10.8 (Mountain Lion) 10.6 (Snow Leopard) 10.5 (Leopard) I cannot find an Open Group certification page for 10.7, nor can I find an explanation for its absence. Apple's page on The Open Group site only lists the current version of OS X as I write ...


44

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 ...


41

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 ...


41

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 ...


39

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


37

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 ...


31

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


28

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 ...


27

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' ...


26

The following is what I ended up using to reliably create a temporary directory that works on both Linux and Darwin (Mac OS X), without hardcoding $TMPDIR or /tmp: mytmpdir=`mktemp -d 2>/dev/null || mktemp -d -t 'mytmpdir'` Background: The GNU mktemp command requires no arguments. Plain mktemp will create a temporary file in the system temporary ...


25

maxproc and maxfiles might go unlimited in previous OSX versions, however in Mavericks, they have an artificial maximum value. To increase default maxproc and maxfiles in launchctl, append the following lines to /etc/launchd.conf (create if it does not yet exist): limit maxfiles 16384 16384 limit maxproc 2048 2048 Be aware: those numbers are about as ...


24

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 ...


23

Under OS X (didn't try on Linux), you can simply type Ctrl+T in the terminal running dd. It will print the same output as kill -INFO $PID, plus the CPU usage: load: 1.40 cmd: dd 34536 uninterruptible 3.49u 64.58s 5020305+0 records in 5020304+0 records out 2570395648 bytes transferred in 4284.349974 secs (599950 bytes/sec) I found out about it reading ...


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

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


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” ...


19

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.


18

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.


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

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 ...


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 ...


18

In bash, . and source are synonyms. Looking into bash source code, file builtin/source.def, you can see . and source use the same internal function source_builtin: $BUILTIN source $FUNCTION source_builtin $SHORT_DOC source filename [arguments] Execute commands from a file in the current shell. Read and execute commands from FILENAME in the current shell. ...


17

The addition of keys to the agent is transient. They last only so long as the agent is running. If you kill it or restart your computer they're lost until you re-add them again. From the ssh-agent man page: excerpt #1 ssh-agent is a program to hold private keys used for public key authentication (RSA, DSA, ECDSA). The idea is that ssh-agent is started ...


16

The easiest way is: $ sw_vers -productVersion 10.6.4 From http://tinyapps.org/blog/mac/201008140700_os_x_version_terminal.html: $ sw_vers ProductName: Mac OS X ProductVersion: 10.6.4 BuildVersion: 10F569 $ sw_vers -productVersion 10.6.4 Especially handy when resetting a password in single user mode, since the method varies based on which ...


16

The problem most probably is that your ls has set option --color to auto which basically means that output should be coloured only if it is connected to terminal, otherwise (output connected to a pipe or a file) no colors are emitted. If you want to have colors is such cases you should set --color option to always, so try ls --color=always | less -R If ...



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