From 277d6495d0b0333b1ce1aa8e77919982522f0a19 Mon Sep 17 00:00:00 2001 From: Marcin Chrzanowski Date: Sun, 12 Jan 2020 15:50:59 +0100 Subject: Add some stuff useful in scripting --- bash.md | 4 ++++ ssh.md | 8 ++++++++ tmux.md | 5 +++++ 3 files changed, 17 insertions(+) diff --git a/bash.md b/bash.md index 26c5b5e..e6e54f3 100644 --- a/bash.md +++ b/bash.md @@ -21,3 +21,7 @@ Remove longest from start Loop over files for file in glob/*; do something $file; done + +## Conditionals + +* `-z`: is empty string diff --git a/ssh.md b/ssh.md index f1d762b..1b5c9be 100644 --- a/ssh.md +++ b/ssh.md @@ -7,3 +7,11 @@ Change password for key: ssh-keygen -p + +## Setup login with public key + + ssh-copy-id [user@]host + +## Execute commands and start shell + + ssh -t host 'commands; bash' diff --git a/tmux.md b/tmux.md index 0972baf..38e5bcb 100644 --- a/tmux.md +++ b/tmux.md @@ -12,3 +12,8 @@ ## Pane management q display pane indices + +## Run command in new session + + tmux new-session \; send-keys 'command ' + # can be entered with Ctrl-V + Enter -- cgit v1.2.3