Shell Cheatsheet
Scroll through (vim) output by page
Instead of holding down up and down to scroll through a long page:
spaceto move down by pagebto move back up by page
Quickly move from end to start of a command prompt
Instead of holding down the left and right arrow keys to move through a command prompt
CTRL + ato go to the start of the promptCTRL + eto go to the end of a prompt
Search through a directory of files for a regex string content
grep -Hn -r -E 'user.+account' ./dir_path
Copy all the file contents of a directory
find /home/vagrant/dotfiles -type f -print0 | xargs -0 cp -t $HOME
- Use
findwith flags-type f -print0to list out all the files in the target directory with a null char delimiter instead of a new line - this allows for the selection of file names with whitespaces and such
- pipe the results into xgargs with flag
-0telling it that the arguments are separated by null chars - xargs is like
.mapon the Unix command line, it turns what has been piped into it into a list of arguments to then call the following command on each one