New answers tagged

0

You can use the pv command if you have it to count lines. Eg find ~ -type d | pv -l -F '%b dirs found' >/tmp/output


0

Not really. Consider that find doesn't know what is in the directory tree, but finds out by reading recursively through all directory listing. (sorry for the pun.) For example there could be two first-level directories, one of which has 1 file, and another that has 1000000 files. Something like copying the tree would be different, since a program could ...


0

Avahi just handles the server half. You need an mDNS configuration set up for the DNS resolver. With glibc, it would be in /etc/nsswitch.conf. I'm not sure where it is in other libcs.


1

Mac OSX xargs does not support long options like GNU xargs. For using --replace like GNU xargs, use -I: find docs/ -name "*png" | xargs -I F python myscript.py "F" Note that this approach breaks with file name contain newline, you want to use find -print0 with xargs -0: find docs/ -name "*png" -print0 | xargs -0 -I F python myscript.py "F" or standard ...


1

xargs on Mac OS X doesn't support the --replace option; you can use -I instead: find docs/ -name "*png" | xargs -I F python myscript.py "F" The strange error message is produced because this version of xargs interprets characters after a single - as options, so with --replace it's looking for an option named -, which doesn't exist.


0

Use 7z.It's better than any.It may be the problem of zip algorithm. Installing 7z or Zarchiver may give you relief.


1

Based on L.Levrel response, using the tools supplied in OS X (this should also work in Ubuntu). find . -type f -name '*.pdf' -exec grep -alE '/Producer \(pdfTeX|/Producer\(pdfTeX' {} +


3

You can look at the "/Producer" line: find -name '*.pdf' | xargs grep -al '^/Producer (pdfTeX' or with double quotes find -name '*.pdf' | xargs grep -al "^/Producer (pdfTeX" or with null-separated list of files find -name '*.pdf' -print0 | xargs -0 grep -al '^/Producer (pdfTeX'


1

From http://apple.stackexchange.com/questions/69223/how-to-replace-mac-os-x-utilities-with-gnu-core-utilities Brew install coreutils your commands will be accessible with g préfix so call gsplit


2

You're missing pass proto icmp. It's usually a reasonable measure to have as your first pass rule: pass quick proto icmp Otherwise you're implicitly blocking that traffic. ICMP is its own protocol, remember, and not covered by TCP or UDP. See the OpenBSD page on PF.


2

When you use grep with color options it produces extra escape character sequences which tell the terminal to turn color on or off, these sequences introduce a risk of not being interpreted properly and causing unexpected results. You can view these by capturing grep's output With no color send greps output to output.txt % grep -o --color=none '.\+ middle ...


1

You are receiving that error because the program "update_prebinding" is not in your PATH, possibly because it is not installed on your system.


1

You can use GNU stat on Linux: stat --file-system --format=%T /tmp/subdir/whatever tmpfs


0

I solved the problem by writing a simple python script to replace the ANSI codes with tmux color variables. #!/usr/local/bin/python s = raw_input("") s = s.replace('\x1b[32m', '#[fg=colour10]') s = s.replace('\x1b[93m', '#[fg=colour11]') s = s.replace('\x1b[0m', '#[fg=colour255]') print s I just pipe the output to the script: istats | grep "CPU temp" | ...


12

The ._ files are how OS X bsdtar handles OS X-specific extended attributes and resource forks. To keep them from being added to your tar files, you can pass COPYFILE_DISABLE=1 as an environment variable to tar. COPYFILE_DISABLE=1 tar cf newTar.tar /your/files


5

To my understanding, tar --exclude='._*' -cvf newTar . should work: Finder creates the ._* files but newTar shouldn't contain them. But you can completely bypass those files by invoking tar in passthrough mode. For example, to copy only the files from oldTar that are under some/path, use tar -cf newTar --include='some/path/*' @oldTar


2

Those files starting with "._*" are apple specific location indicator files according to THIS POST and you obviously can not get rid of them while logged in to your terminal om OSX, again according to the same page. You need to upload the file to a non-apple OS, get rid of those files and tar them up again. This seems to be the only solution.


3

MacPorts has dash, which is what Debian uses. For that and other choices, read Is there a minimally POSIX.2 compliant shell?, in which the answers point out that the standard is vague in places.


0

Most Unix variants disable setuid on scripts for security reasons. For more information, see Allow setuid on shell scripts Earlier versions of OS X had a setting to allow setuid scripts: sysctl kernl.sugid_scripts=1, but I don't see it documented on 10.9. I don't know if it still exists but isn't documented, and if it still exists I don't know if it's ...


0

It turns out the .AppleDouble files are at fault. When I ls -la and look at my .AppleDouble file in the directory in question: drwxrwxrw- 2 admin admin 28672 May 5 15:13 .AppleDouble The issue is the executable bit under the other permissions. Netatalk users need the execute bit set to use the files inside the folder. This is why the group and ...


2

Try this instead: osascript -e 'tell Application "Safari" to activate' osascript -e 'tell application "System Events"' -e 'keystroke "a" using command down' -e 'end tell'


0

find dir -name just supports shell file name glob characters as documented by man fnmatch. Some find implementations support non-standard extensions for regular expressions. Check your find man page.


1

-name takes wildcard patterns, not regexps and matches on the file name, not its full path. Use -regex (or -iregex) for regexp matching but beware it matches against the full path. Here, you could do: LC_ALL=C find -E . -iregex '.*s[0-9]{1,2}\.?e[0-9]{1,2}[^/]*\.mkv' Here, we're replacing the second .* with [^/]*, that is a sequence of non-/ characters to ...


-1

If you want it to apply in all accounts, you can also put alias ll='ls -lG' in /etc/profile.


3

My El Capitan has no setattr or setxattr (the latter is the name of a C runtime function: you could make your own utility using that). OSX provides xattr, which (noting comments such as Mac OS X Extended Attributes and Xattr) seems fairly recent. A comment in Manually set extended attributes on arbitrary files from 2011 gives a hint about OSX 10.5 You can ...


0

It's called xattr on OS X . You can use setxattr to set attributes.


1

The filesystem in /Volumes that you mention is the installation virtual disk (dmg). Hence why it is read only. Umount/Eject it and it will be gone. You can do it via the graphical interface or via: sudo diskutil umount '/Volumes/Grammarian PRO2 X' Be also careful what you do with the /Volumes directory, because it is the root of all your mounted ...


0

I had the same problem but I had it while running brew upgrade it, but I hope it will help you What helped in my case I cleaned up with brew cleanup boost Then I brew unlink boost Then brew uninstall boost Further brew cleanup ncmpcpp And brew unlink ncmpcpp - probably not needed for you Then brew uninstall ncmpcpp After in /Libraries/Caches/Homebrew I ...


0

Also, if you just want to exclude some lines ahead of a given marker, you could use: awk -v nlines=2 '/Exception/ {for (i=0; i<nlines; i++) {getline}; next} 1' (glenn jackman at http://stackoverflow.com/a/1492538 ) By piping some commands you can get the before/after behaivour: awk -v nlines_after=5 '/EXCEPTION/ {for (i=0; i<nlines_after; i++) ...


1

You can reach a good-enough result by using temporary files: my_file=file.txt #or =$1 if in a script #create a file with all the lines to discard, numbered grep -n -B1 -A5 TBD "$my_file" |cut -d\ -f1|tr -d ':-'|sort > /tmp/___"$my_file"_unpair #number all the lines nl -nln "$my_file"|cut -d\ -f1|tr -d ':-'|sort > /tmp/___"$my_file"_all #join the ...



Top 50 recent answers are included