Linux,os X Mark Tool (Directory Jump tool)

Source: Internet
Author: User

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)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.