A piggy bank of commands, fixes, succinct reviews, some mini articles and technical opinions from a (mostly) Perl developer.

Jump to

Quick reference

Showing posts with label remote. Show all posts
Showing posts with label remote. Show all posts

Fix home and end keys in remote shell

$ od -c

<home key pressed>   ^[[7~
<end key pressed>    ^[[8~

Then put in /etc/inputrc or ~/.inputrc:

"\e[7~": beginning-of-line
"\e[8~": end-of-line

An actual example:

"\e[1~": beginning-of-line
"\e[4~": end-of-line
"\e[3~": delete-char

(source)

sudo: no tty present and no askpass program specified

How to run sudo on a remote machine:

ssh user@domain.com 'sudo echo "foobar"'

Error:
    sudo: no tty present and no askpass program specified

Solution:

 ssh -t user@domain.com 'sudo echo "foobar"'

(source)

Sublime text editor tricks

Sublime is not a bad text editor for Linux:

Mount a remote directory:  sshfs username@hostname:/remote/path /local/path

Put a vertical line after 80 characters: Preferences > Settings - User > ... add an entry: "rulers": [80]

Change syntax highlighting colours: Preferences > Browse Packages > Color Scheme - Default > ... edit the Color Scheme file you are using.

{
"color_scheme": "Packages/Color Scheme - Default/All Hallow's Eve.tmTheme",
"font_size": 10,
    "rulers": [80],
    "auto_complete": false
}


Shortcuts:

  • Shift-F11 = Enter "concentration" mode AKA "distraction free" mode

Developing over FTP

Using Eclipse and RSE plugin:
  • Logs in okay
  • But seems to always be closing directory sub-trees I've opened in 'Remote Systems' panel
  • It wants to do an 'ls' on every parent directory in the hierarchy, every time I change files. Very slow.
Using CurlFtpFS:
  • Install in Ubuntu from the software centre
    • to mount: curlftpfs -v username:password@server.example.com local_dir/
    • to unmount: fusermount -u local_dir/
  • Performance is unusably slow... Eclipse wants to know about every single file on the remote server, not just the ones I'm editing.
  • Saving the file through Eclipse using CurlFtpFS takes even longer than it would to upload it separately.
Using FileZilla and gedit:
  • Browsing is fast
  • Editing is fast
  • But you have to navigate to every file manually each session, it doesn't remember what you had open
  • The system of holding temp files locally is not ideal, but FileZilla detects changes in them very nicely
  • You still can't grep over the files as they're all held remotely, and it's a bit fiddly to navigate to a specific file
    Editing locally with Eclipse, and uploading after changes are made:
    • Write an Ant script to upload any modified files?
    • ...to investigate

    Remote file browsing

    • Mount a remote filesystem via SFTP
      • (Mac): http://pqrs.org/macosx/sshfs/
      • (Ubuntu): Use software centre
      • GUI
        • Try http://sshfs-gui.darwinports.com/
        • or Mac ports: sudo port install sshfs-gui
      • To start: sshfs hostname: mountpoint
      • To stop: fusermount -u mountpoint
    • Target Management (Remote file browsing in Eclipse via SSH): http://www.eclipse.org/dsdp/tm/