dotfiles/docs/Bash.md

188 lines
3.4 KiB
Markdown
Raw Normal View History

# Bash Aliases & Scripts
## Navigation
* *..* → cd ..
* *...* → cd ../..
* *....* → cd ../../..
* *.....* → cd ../../../..
* *~* → cd ~
* *-* → cd -
## Shortcuts
* *dr* → cd ~/Dropbox
* *pj* → cd ~/Dropbox/Projects
* *pjr* → cd ~/Dropbox/Projects/_Repos
* *pjf* → cd ~/Dropbox/Projects/_Forks
* *pjm* → cd ~/Dropbox/Projects/!
* *o* → open
* *oo* → open .
* *e* → subl
* *gh* → github
* *+x* → chmod +x
* *md <dir>* → Make directory and `cd` to it.
* *f <what>* → Recursively find file in current directory.
* *c* → Trim new lines and copy text to clipboard.
## File System
### extract <filepath> [directory]
Extract archives of various types.
### emptytrash
Empty the Trash on all mounted volumes and the main HDD. Also, clear Apples System Logs to improve shell startup speed.
2012-12-19 12:59:34 +00:00
### cleandesktop
Remove screenshots from desktop.
### show / hide
Show/hide hidden files in Finder.
2012-12-20 12:48:10 +00:00
## Files
### dos2unix <filepath>
Convert file to Unix line endings.
### crlf [--force]
Find files with Windows line endings (and convert them to Unix when `--force` key given).
2012-12-20 12:48:10 +00:00
## Text, HTML, CSS
### escape <characters>
Escape UTF-8 characters into their 3-byte format: `£` → `\xC2\xA3`.
### codepoint <character>
Get a characters Unicode code point: `£` → `\x00A3`.
2012-12-20 12:48:10 +00:00
### hex2hsl <[#]dead00> [alpha]
Convert #hex color to HSL/HSLA. `#dead00``hsl(47,99%,44%)`.
### hex2hsl <[#]dead00> [alpha]
Convert #hex color to RGB/RGBA. `#dead00``rgb(222,173,0)`.
## Network
### GET / HEAD / POST / PUT / DELETE / TRACE / OPTIONS <URL>
Make HTTP request using respective method.
### headers <URL>
Print HTTP headers of a given URL.
### gz <filepath>
Get gzipped file size.
### httpcompression <URL>
Test if HTTP compression (RFC 2616 + SDCH) is enabled for a given URL. Send a fake UA string for sites that sniff it instead of using the Accept-Encoding header.
2012-12-12 11:18:16 +00:00
### ssh-key
Copy public SSH key to clipboard. Generate it if necessary.
### add-ssh-host <username> <hostname> <identifier>
Create an SSH key and uploads it to the given host.
### yay
Upload current directory to special directory on my hosting.
2012-12-12 12:52:53 +00:00
### mysql-dump <ssh_hostname> <mysql_database> [mysql_username] [mysql_host]
Backup remote MySQL database to `~/Backups/hostname/dbname_YYYY-MM-DD.sql.gz`.
2012-12-12 13:59:18 +00:00
### rasterize <URL> <filename>
Save page screenshot to file.
## NPM
### npm-patch / npm-release
Increment version (`npm-patch` by 0.0.1 and `npm-release` by 0.1.x) of NPM package and make Git commit.
## Grunt
### gw / gs
Run Grunts watch and server tasks:
gw → grunt deploy --debug && grunt watch --debug
gs → grunt deploy --debug && grunt serve --debug
### gi [template]
Just shortcut for `grunt-init`.
## Magic Project Opener
### proj / repo / wptheme [project]
Change current directory to project folder / Git repo / Wordpress theme forlder of given “project”. Use fuzzy search.
## Misc
### password [length]
Generate random password and copy it to clipboard. Default length is 8.
### path
Show $PATH in a readable way.
### dotfiles
Update dotfiles. Pull latest version from GitHub, syncronize symlinks and reread `~/.bashrc`.
### update
Get OS X software updates, update Homebrew, NPM, Ruby packages, dotfiles and some other software.
### nyan
Print nyan cat :-)
2012-12-20 07:39:05 +00:00
2012-12-20 13:21:18 +00:00
### dot-bash / dot-git / dot-hub / dot-extras
2012-12-20 07:39:05 +00:00
2012-12-20 13:21:18 +00:00
Open help in a browser: Bash aliases (this file), Git aliases, hub, git-extras.