Tagged "terminal"

Run Command on SSH Login

Do you need to run a command on SSH login? There are a lot of solutions on the web for this, but most of them are very complex. I stumbled across this easy method of using the authorized_keys file, simply add command="ls -l" (replacing ls -l with something a bit more useful like tmux or screen) in front of the key fingerprint. This also means you can have different commands for different keys if you choose.

iOS Shells, Prompt vs. Mosh

I’m a big fan of the shell and the productivity it brings, you can have a text editor, command to run a server and more within easy reach. I use a shell at work, at home and on the go. On the go could be using my iPad or iPhone. One of the first SSH clients on iOS was iSSH, which I used many years ago. After this, Panic released a professional class application called Prompt. Prompt is what I’ve happily used for the last few years, but the 10 minute background process limit is a constant pain. Just a quick switch away for a few minutes, and you have to reconnect. That’s fine once or twice, but when it happens many times it seriously slows your productivity.

Why GNU Grep is fast

Worth a read for those wishing to optimise programs that process a lot of data. It proves that less really is more…

Money quote:

The key to making programs fast is to make them do practically nothing.

Fish Shell for Ubuntu and OS X

A great guide to get up to speed with Fish shell. What is Fish? It’s a shell written from the ground up to be more easily understandable the the traditional shells (bash, tcsh). I don’t know yet if I’ll switch (anything you can do in Fish can be made to work in Bash). It’s an interesting concept and I’ll try it for a while…

Quickly navigate your filesystem

The article is a great tip for those who spend a good chunk of the working day on the command line. I made some adjustments to Bash completion code to get it to work on Mac OS X:

Original:

 \_completemarks() { local
curw=${COMP_WORDS[COMP_CWORD]}
  local wordlist=$(find
$MARKPATH -type l -printf "%f\n")
  COMPREPLY=($(compgen -W
'${wordlist[@]}' -- "$curw")) return 0 }

complete -F \_completemarks jump unmark 

My modified version (tested on Mac OS X and Ubuntu):

SSH Config Aliases

If your like me and you deal with a lot of servers for development or test and do it from a Unix machine, I’ve got a really handy tip: SSH hostname pattern matching.

Say I’ve got a SSH config file like this (at ~/.ssh/config ):

host s*
    HostName atrcu%h.example.com
    User example1
    Port 22
host b*
    HostName atrcx%h.example.com
    User example2
    Port 22
host ??*
    HostName atvts%h.example.com
    User example5
    Port 2205

The ssh man page explains this really well:

Custom Colourful Bash Prompt

Bash, a command line shell is one of the most used pieces of software in my daily work. I like scripting repetitive actions to save a lot time (it brings me great joy!). One of the simplest and easiest customisations is to add a bit of colour to your otherwise boring bash prompt (otherwise known as $PS1):

[ngrogan@localhost:~]$

can be turned in to this:

My Custom Colour Bash Prompt

The thing about Bash is the colour codes to achieve this can look archaic:

SSH Guide

**Note: This Guide was written for use by my Computer Science class

on Linux (and Mac OS X where noted). I haven’t used SSH on Windows; but hopefully someone can make sure this guide works also on Windows by noting differences). SSH comes with nearly all Linux distros and all Mac OS X releases.
**

OS Specific Colours: Linux - Mac OS X - Windows
**
**
**Download SSH For Windows
**