Last active
April 26, 2018 09:55
-
-
Save httpsterio/be8197c57a568ad5cb650cbd5875ac24 to your computer and use it in GitHub Desktop.
A few handy bash commands I created for my own needs.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cpath () { | |
pwd > ~/.pathfile | |
echo 'path copied' | |
} | |
ppath () { | |
cd $(cat ~/.pathfile) | |
} | |
cfile () { | |
cat $1 > ~/.copyfile | |
echo 'file content copied' | |
} | |
pfile () { | |
cat ~/.copyfile | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is a part of my .bashrc.
It's a series of commands that allows you to save a folder location and cd into it, for example when invoking a new terminal and you want to jump to the place where you were quickly.
It also allows you to output a file content into a file and output the saved content. I use it for example to copy a file's content so that I can pass it to another command like "pfile | tail -c 5" to get the last five characters of a file, without the need to write the full path to the files.
cpath = copy path
ppath = paste path (aka cd into saved path)
cfile = copy file content
pfile = paste file content