# open directory of a file path # can be used together with the [esc-.] key sequence function odf() { /usr/bin/open "$(/usr/bin/dirname "$@")"; return 0; } # cd to the directory of a file path function cdf() { cd "$(/usr/bin/dirname "$@")"; return 0; } ls -l /Library/Desktop\ Pictures/Nature/Tranquil\ Surface.jpg ls -l /System/Library/CoreServices/CoreTypes.bundle/Contents/Resources/ExecutableBinaryIcon.icns odf [esc-.] cdf [esc-.] odf /System/Library/SystemProfiler/SPFirewallReporter.spreporter/Contents/Resources/ cdf /System/Library/SystemProfiler/SPFirewallReporter.spreporter/Contents/Resources/English.lproj/Localizable.strings
Never been to CodeSnippets before?
Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world (or not, you can keep them private!)
open or cd to the directory of a file path (See related posts)
You need to create an account or log in to post comments to this site.
Related Posts
» Counting lines in awk grep shell osx mac bash line unix c count file sed directory lines wc countlines
» ffind - fuzzyfind from the c... in find shell osx mac bash unix file directory
» Find largest files on Mac OS X in find awk sort regex shell osx mac bash unix linux c filesystem file ls array mount sed size directory mdfind scan device gnu volume largest printf stat xdev bsd partition bigfiles localvols
» realpath function for Mac OS X in shell osx mac bash resolve unix linux file link directory symlink symbolic path gnu readlink realpath
» Get full path to executing s... in shell osx mac bash script unix file running directory path full absolute executing
» Counting files in find shell osx mac bash unix linux c count file recursive api directory scan manager print0 fts countfiles carbon
Snippets (source code soon to be available) developed by Peter Cooper and powered by Ruby On Rails