Tag Info

Hot answers tagged

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


8

STDOUT and STDERR don't have colors. What has color is your terminal (emulator); it has one foreground (and one background color) set at a time. It should also be noted that STDOUT and STDERR are not singular -- they're per process output streams. There is no global STDOUT that applies to all programs. These streams are routed to your terminal, but they ...


7

With zsh on terminals that support 16 colors or more à la xterm: preexec() printf '\e[90m' # set foreground color to grey before running # the command precmd() printf '\e[m' # reset the foreground color before issuing the # next prompt. Note that commands may change the terminal's foreground color ...


7

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


5

The issue is indeed that the Finder's way of modifying permissions doesn't only affect the indicated bits as one might think. For some reason it zeroes out the first octal of the file's mode and it leaves the executable bits untouched. So, some vital programs get their setuid/setgid and sticky bits stripped off which makes them either useless or behave ...


3

remap control : bind -x '"\C-l": clear'


3

You're basically wanting to reset the terminal color right before bash executes the command. This can be done with a trap. For example: trap '[[ -t 1 ]] && tput sgr0' DEBUG Bash executes the DEBUG trap immediately before the command, so this will result in tput sgr0 (which resets formatting attributes) being run before each command. The [[ -t 1 ...


2

The brace expansion you're asking about will only expand for files/directories that match on disk to the pattern you use. The other issue you'll run into is diskutil may not be able to handle more than 1 argument at a time. To expand these you'd need to do a while or for loop, and pass the results to diskutil as you iterate through the loop. Example $ for ...


2

Let's start with some "history". /usr/local is typically used to store user programs/data that were not installed with the base operating system. Commonly, when you make programs from source using automake, they will install somewhere under /usr/local. Because the main operating system itself doesn't rely on this directory, permissions are really up to the ...


1

Of course it's not persistent, the ssh-agent is a session service that stores keys temporarily for the user. The main purpose of SSH agent is to remember the cleartext version of a key secured using a passphrase. In other words, the key is stored on the disk encrypted using a passphrase and the owner of the key uses ssh-add or some GUI tool to provide the ...


1

Run dtruss to see what system calls a process is making: dtruss -p55761 This will tell you what system call the process with PID 55761 is currently engaged in. If that system call accesses some file descriptor, lsof will tell you what file is open there. lsof -p55761 If the file is a pipe or socket, I don't know how to find what if anything is on the ...


1

xargs does an unfortunate amount of parsing on its input, and depending on what characters occur in filenames (spaces, quotes/apostrophes, backslashes, tabs, etc) it can mangle them in a number of ways. The best way to handle filenames is as a null-delimited list and using xargs -0 (which turns off all of the parsing). If the file list were generated from ...


1

I found a solution in which I needed to replace a space with a backslash and a space on OS X. Here is what I came up with: echo "Hello World" | sed 's/ /\\ /g' | xargs echo With this all the spaces are retained.


1

This seems to be a question with the XY-problem - it's not asking the right thing to get the desired solution: Assume the output is colored, and the empty part of the screen is of different color or filled with a character. Think about how you expect the output to look for these cases: An empty line? Lines filled with only space characters? Lines ...


1

If the output of diskutil list is something like disk0 disk0s1 disk1 disk1s1 (separated by space or newline) then you need something like this: for dev in $(diskutil list); do diskutil info "$dev" done find find ~/ -type f \( -name '*mp3' -or -name '*mp4' \) You must quote the metacharacters which find shall see.


1

I found a way around my particular problem thanks to this answer. It is MacOS only though. SetFile -d "$(GetFileInfo -m filename.wav)" filename.wav



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