Tag Info

Hot answers tagged

5

I would say that it is misleading to call getpid() a "linux system call". That gives the impression that it is a Linux-specific system call, which it isn't. Actually, getpid() and many other system calls are specified by POSIX, and you will find it implemented on both Linux and MacOS and on many other systems, with identical behaviour. The majority of ...


4

Use script /tmp/output to start recording in a new shell, then type your commands and look in the /tmp/output file, e.g. with an editor or cat -vet. Type exit to the shell to exit the recording.


4

Most core utilities behave differently when they output to an interactive terminal. If they detect you are outputting into a file or a pipe, they don't format (reasonably so: we don't want color escape sequences when we are processing file lists with a script). For ls, you can force it: CLICOLOR_FORCE=1 ls -G (That's for OSX; on Linux, that would be ls ...


3

For ls you can do export CLICOLOR_FORCE=X ls -G | cat -vet


3

Probably best to run the output through a hex viewer (e.g. od, hexdump, xxd): % man less | hexdump -C | head -5 00000000 4c 45 53 53 28 31 29 20 20 20 20 20 20 20 20 20 |LESS(1) | 00000010 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | | * 00000040 20 20 20 20 20 20 20 4c 45 53 53 28 31 29 0a 0a | LESS(1)..| 00000050 ...


2

OS X is a certified UNIX operating system, guaranteeing it implements the POSIX standard. Linux, while not a certified UNIX, also implements the POSIX standard. If you limit your API calls to things that are part of POSIX you should have consistent behavior between OS X and Linux. Aside from POSIX, the C standard library is also standardized and you ...


2

Use this: security find-certificate -c "certificatename" -a -Z | \ sudo awk '/SHA-1/{system("security delete-certificate -Z "$NF)}' awk is called with sudo. awk then searches for the string SHA-1 and calls the security delete-certificate command with the hash as argument. You have to provide the sudo password only once.


1

Some shells, including bash, allow you to type any literal character (e.g. Ctrl-I for Tab, Ctrl-M for Return) by prefixing it with Ctrl-V, so you could type Ctrl-V Ctrl-I instead of \t wherever it appears in your sed one-liner.



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