Reprint please specify the source Lin Xi Wood greatly
When you do something on the command line, you often encounter a situation where you switch back and forth between multiple directories. This time will be very distressed. So after searching the Internet, summarize the following:
Ubuntu/centos:
Edit. Bash_profile (or. Profile)
Add the following content:
1Export Markpath= $HOME/. Marks2 3 #mark in the directory where you want mark: Mark alias4 functionMark {5 mkdir-P"$MARKPATH";LN-S"$ (PWD)" "$MARKPATH/$1"6 }7 8 #jump Skip to Mark's directory in any directory: Jump alias9 functionJump {TenCd-p"$MARKPATH/$1" 2>/dev/NULL||Echo "No such mark: $" One } A - #unmark Delete already Mark's directory in any directory: Unmark alias - functionUnmark { the RM-I."$MARKPATH/$1" - - # Use the following sentence when deleting without a reminder -#RM-rf"$MARKPATH/$1" + } - + #marks Show all Mark's directories A functionMarks { at ls-L"$MARKPATH"|sed 's///g'|Cut-D' '-f9-|sed 's/-/\t-/g'&&Echo - } - - - -#此处的功能是 Use Jump/unmark +Double-click the tab prompt for the mark's directory in _completemarks () { -Local curw=${comp_words[comp_cword]} toLocal wordlist=$ (Find$MARKPATH-type l-printf"%f\n") +Compreply= ($ (compgen-w'${wordlist[@]}'--"$CURW")) -Return0 the } *Complete-f _completemarks Jump Unmark
OS X
Edit. Bash_profile (or. Profile)
Add the following content:
1Export Markpath= $HOME/. Marks2 3 #mark in the directory where you want mark: Mark alias4 functionMark {5 mkdir-P"$MARKPATH";LN-S"$ (PWD)" "$MARKPATH/$1"6 }7 8 #jump Skip to Mark's directory in any directory: Jump alias9 functionJump {TenCd-p"$MARKPATH/$1" 2>/dev/NULL||Echo "No such mark: $" One } A - #unmark Delete already Mark's directory in any directory: Unmark alias - functionUnmark { the RM-I."$MARKPATH/$1" - - # Use the following sentence when deleting without a reminder -#RM-rf"$MARKPATH/$1" + } - + #marks Show all Mark's directories A functionMarks { at ls-L"$MARKPATH"|Tail-N +2|sed 's///g'|Cut-D' '-f9-|awk-F' -' '{printf "%-10s-%s\n", $, $)' - } - -#此处的功能是 Use Jump/unmark +Double-click the tab prompt for the mark's directory - _completemarks () { -Local curw=${comp_words[comp_cword]} inLocal wordlist=$ (Find$MARKPATH/-type L-execStat-F"%N"{} \; |sed 's/^.*\/\///g'|sed 's///g') -Compreply= ($ (compgen-w'${wordlist[@]}'--"$CURW")) toReturn0 + } -Complete-f _completemarks Jump Unmark
Related website: http://jeroenjanssens.com/2013/08/16/quickly-navigate-your-filesystem-from-the-command-line.html
Reprint please specify the source Lin Xi Wood greatly
Linux,os X Mark Tool (Directory Jump tool)