From 2e22fabc17bfc022ebcea4aa20e5e540c8584e0b Mon Sep 17 00:00:00 2001 From: Brandon Eskridge Date: Thu, 2 Sep 2021 09:16:37 -0400 Subject: [PATCH 1/4] Update bash.md --- pages/bash.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/pages/bash.md b/pages/bash.md index df8d005..0e94861 100644 --- a/pages/bash.md +++ b/pages/bash.md @@ -23,9 +23,9 @@ Exporting bash functions is better than alias, as it is accessible outside of th User your_username ForwardX11 yes ForwardX11Trusted yes - DynamicForward 127.0.0.1:61080 # (I think) this allows other SSH sessions to use this one, so you don't have to log in again. - ControlPath ~/.ssh/.%r@%h:%p - ControlMaster auto + DynamicForward 127.0.0.1:61080 # This enables port forwarding through the SSL tunnel + ControlPath ~/.ssh/.%r@%h:%p # (with 'ControlMaster auto' set) specifies the localation of the control socket for ssh multiplexing (See below) + ControlMaster auto # This allows other SSH sessions to use same SSL tunnel so that you don't have to log in again (called ssh multiplexing) ServerAliveInterval 100 # stop the connection from closing automatically. ``` @@ -78,3 +78,4 @@ ls runs{0..9}.out # will try to ls 10 files from 0 to 9 (I think # ZSH Bash superset. ‘Oh my ZSH’ on github, package manager. Grep automatically at the shell. + From 7a62407d7558d558da8645f27786fa43ad62cdae Mon Sep 17 00:00:00 2001 From: Brandon Eskridge Date: Thu, 2 Sep 2021 11:26:20 -0400 Subject: [PATCH 2/4] Update bash.md Filled in some details about some of the more 'advanced' ssh features --- pages/bash.md | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/pages/bash.md b/pages/bash.md index 0e94861..2224eb9 100644 --- a/pages/bash.md +++ b/pages/bash.md @@ -23,12 +23,16 @@ Exporting bash functions is better than alias, as it is accessible outside of th User your_username ForwardX11 yes ForwardX11Trusted yes - DynamicForward 127.0.0.1:61080 # This enables port forwarding through the SSL tunnel + DynamicForward 127.0.0.1:61080 # This enables port forwarding through the SSL tunnel (more below) ControlPath ~/.ssh/.%r@%h:%p # (with 'ControlMaster auto' set) specifies the localation of the control socket for ssh multiplexing (See below) - ControlMaster auto # This allows other SSH sessions to use same SSL tunnel so that you don't have to log in again (called ssh multiplexing) + ControlMaster auto # This allows multiple SSH sessions to use same SSL tunnel so that you don't have to log in again (called ssh multiplexing) ServerAliveInterval 100 # stop the connection from closing automatically. ``` +Port forwading ('DynamicForward' option above) is very general and can be used for many different things, including a similar effect to ProxyJump (see below). Port forwarding can be used to forward traffice to a different host:port combination. More on ssh port forwarding: https://www.redhat.com/sysadmin/ssh-dynamic-port-forwarding + +SSH Multiplexing ('ControlMaster','ControlPath',etc.) is focused scpeficially on allowing multiple ssh sessions to share the same "master" session. As long as the master session is active, new ssh sessions can simply connect automatically without having to log in again. This is very useful when combined with Proxy-jumping (below). It is a good security practice to close the master session when you won't be connecting again for a while (like at the end of the day). More on on ssh multiplexing: https://www.techrepublic.com/article/how-to-use-multiplexing-to-speed-up-the-ssh/ + Proxy-jump to iterate login commands (a la Bryan) ``` Host flatiron From eb6da04c391145c7ad0913d282261d5ff673e005 Mon Sep 17 00:00:00 2001 From: Brandon Eskridge Date: Thu, 2 Sep 2021 12:21:33 -0400 Subject: [PATCH 3/4] Update editors.md Recorded some of the basic emacs commands (and cited some good external references) --- pages/editors.md | 55 +++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 52 insertions(+), 3 deletions(-) diff --git a/pages/editors.md b/pages/editors.md index ea20f33..cb077ad 100644 --- a/pages/editors.md +++ b/pages/editors.md @@ -105,19 +105,68 @@ Cons: Good for: - general purpose text editting - code development +- people that are very comfortable using regular expressions Useful commands: -Rectangles. +Due to the complexitly of emacs, here, we assume some familiarity with the basics ( check out this [Emacs tutorial](https://www.gnu.org/software/emacs/tour/) ). -`ctrl-a/y` cut and paste. +a rule of thumb is that most 'commands' will involve `ctrl-` (hold ctrl while typing , then release both), and + then various macros and addons usually use `meta-` and usually some more input, where the `meta` key is usually the left alt key. + `Ecp` can be used as a stand in for meta, but should *not* be held down `Esc ` = `meta-`. -`ctrl-space` is highlighting. +run `$ emacs -nw file_to_edit` to run emacs in the terminal (without '-nw', emacs will try to open it's own window) + +`ctrl-x ctrl-s` saves the current buffer(file) + +`ctrl-x ctrl-c` close emacs (will prompt you to save files, etc. in the 'minibuffer' at the bottom of the screen) + +`ctrl-x u` undo changes + +`ctrl-z` sends emacs to the background - resume with `$ %emacs` assuming emacs is the only 'job' running in the background + +`ctrl-g` and `Esc Esc`, can be used to cancel partially entered commands. + +`ctrl-space` is set marker + +Set marker(`ctrl-space`), then `ctrl-w` will *cut* the selected text. + +Set marker(`ctrl-space`), then `meta-w`(usually `left alt-w`) will *copy* the selected text. + +`ctrl-y` will yank(paste) at the current cursor position + +`ctrl-x ctrl-f` file_name will open 'file_name' in current active buffer + +opening multiple buffers: + +`ctrl-x 2` splits current buffer in to two buffers with a horizontal split + +`ctrl-x 3` splits current buffer in to two buffers with a vertical split + +`ctrl-x o` cycle between the 'split' buffers + +`ctrl-x 1` closes all 'split' buffers except the active one + +`meta-x shell` opens a shell (sometimes in new 'split' buffer, sometimes in current buffer depending on the configuration) + +Working with "Rectangles" which are a rectangular segment (in terms of rows and columns) of a file. +To define a rectangle, place a marker in one of the corners: + - navigate to any corner of the rectangle (you can use the arrow keys to navigate) + - type `ctrl-space' to set a marker at that corner + - navigate to the opposite (diagonally) corner + - use any of the following 'rectangle' commands + - kill rectangle `C-x r k` + - yank rectangle `C-x r y` + - open rectangle, shifting text right C-x r o + - blank out rectangle C-x r c + - prefix each line with a string C-x r t Can split between a shell and a editing screen. Will auto-save things. +GNU.org's [cheat sheet](https://www.gnu.org/software/emacs/refcards/pdf/refcard.pdf) + ## Sublime Text (text editor) Pros: From 22dd0c02db6c500c8297fb7e0a5c9901b1219e69 Mon Sep 17 00:00:00 2001 From: Brandon Eskridge Date: Thu, 2 Sep 2021 12:23:59 -0400 Subject: [PATCH 4/4] Update editors.md --- pages/editors.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/pages/editors.md b/pages/editors.md index cb077ad..f00a170 100644 --- a/pages/editors.md +++ b/pages/editors.md @@ -105,7 +105,6 @@ Cons: Good for: - general purpose text editting - code development -- people that are very comfortable using regular expressions Useful commands: @@ -113,7 +112,7 @@ Due to the complexitly of emacs, here, we assume some familiarity with the basic a rule of thumb is that most 'commands' will involve `ctrl-` (hold ctrl while typing , then release both), and then various macros and addons usually use `meta-` and usually some more input, where the `meta` key is usually the left alt key. - `Ecp` can be used as a stand in for meta, but should *not* be held down `Esc ` = `meta-`. + `Esc` can be used as a stand in for meta, but should *not* be held down `Esc ` = `meta-`. run `$ emacs -nw file_to_edit` to run emacs in the terminal (without '-nw', emacs will try to open it's own window)