Sometimes I have to put text on a path

Friday, March 27, 2015

iTerm2 terminal (Apple OSX)

Many features: Mac OSX List Unix commands

Terminal ( is the terminal emulator included in the OS X operating system by Apple.
As a terminal emulator, the application provides text-based access to the operating system (or server) , in contrast to the mostly graphical nature of the user experience of OS X, by providing a command line interface to the operating system when used in conjunction with a Unix shell, such as bash.
Now with OSX 10.9.1, version of Terminal = 2.4

The preferences dialog for in OS X 10.8 (Mountain Lion) offers choices for values of the TERMenvironment variable
Available options are ansidttermnstermrxvtvt52vt100vt102xtermxterm-16color andxterm-256color, which differ from the OS X 10.5 (Leopard) choices by dropping the xterm-color and adding xterm-16color and xterm-256color
These settings do not alter the operation of Terminal, and the xterm settings do not match the behavior of xterm.
Terminal includes several features that specifically access OS X APIs and features. These include the ability to use the standard OS X Help search function to find manual pages and integration with Spotlight

List Unix commands
gives "ls" with all options

By alphabetical orders:

Three Terminal Commands to get you started (mac apple; linux; Unix)

If you’re running Mac OS X, or your favourite flavour Linux, you’re all set. Just fire up the terminal, and keep going. 

there’s a good change you’ll want to see the contents of a file from the terminal sooner or later. There’s a few commands that will do this for you. First is catcat is short for “concatenate”, and this command does more than output file contents; however, that’s what we’ll look at here. It’s as simple as passing the command a file:
However, if the file is large, the contents will all scroll past you and you’ll be left at the bottom. Granted, you can scroll back up, but that’s lame. How about using less?
Less is a much better way to inspect large files on the command line. You’ll get a screen-full of text at a time, but no more. You can move a line up or a line down with the k and j respectively, and move a window up or down with b and f. You can search for a pattern by typing /pattern. When you’re done, hit q to exit the less viewer.
Most of the commands you’ll use in a bash shell are pretty flexible, and have a lot of hidden talents. If you suspect a command might do what you want, or you just want to see some general instruction on using a command, it’s time to hit the manuals, or man pages, as they’re called. Just type man followed by the command you’re curious about.
You’ll notice that the man pages are opened in less.

Thursday, March 26, 2015

Some clients SSH for mac OS, Apple, macintosh OSX, Cross-platform

The following clients are recommended for interoperating with OpenSSH from Mac OS machines. Note that Mac OS X includes OpenSSH by default (application: terminal; only command line =no GUI).
  • WinSCP is an open source free SFTP client, SCP client, FTPS client and FTP client for Windows. Its main function is file transfer between a local and a remote computer. Beyond this, WinSCP offers scripting and basic file manager functionality. Like Cyberduck, or Filezilla, but more powerful! 

Remark: You can use winscp to connect to mac machine, but after you enable ssh on mac (System Preferences -> Sharing -> Check Remote Login).


One of the best GUI application for SSH (and everything else you can do on the command line) is iTerm 2 While the original iTerm had a tabbed interface before Terminal did, iTerm 2 again eclipses Terminal by adding:
  • Support for 256 colors (you'll never go back to 16 colors after using 256)
  • Split panes (the sort of thing you can do in GNU screen or tmux, but at the level of the terminal emulator rather than in a program running on the server)
  • Special provision for integrating with tmux (an alternative to GNU screen, and which most people regard as better & faster than screen)
  • Terminal-level auto-completion (I don't use this feature so I can't detail how it has advantages over shell-level autocompletion: especially if you use the fish shell or zsh, then it may not be better)
  • Growl support
  • an Exposé-like view of your tabs
  • a full-screen view (and you can choose from either its own or OS X's built-in full-screen mode; I greatly prefer iTerm's own full-screen mode, since it doesn't force you to move to a new 'Space', thus allowing Command-Tab to still work properly)
  • paste history (a good complement to the shells' command histories)
  • Search
  • Instant Replay
ZOC • SSH/Telnet Client and Terminal Emulator for Mac OS X and Windows
not free

  • NiftyTelnet 1.1 SSH is an SSH1-only implementation which comes with a scp-style program. Written by Jonas Wallden."NiftyTelnet 1.1 SSH r3 is an enhanced version of Chris Newman's NiftyTelnet 1.1 application which adds support for encrypted terminal sessions using the SSH (Secure Shell) protocol. Please read the included Readme file before distributing this version."
  • MacSSH is an SSH2-only implementation."MacSSH is a modified version of BetterTelnet with SSH2 support. [...] The only SSH2 client for Mac OS that I could find is a commercial product thats costs more than $100, and it crashes my Mac when closing a session... Since it's best to do things by oneself, here's MacSSH."
  • Fugu is an implementation of SFTP and SCP for Mac OS X."Fugu SSH is a Mac OS X graphical frontend to OpenSSH's Secure File Transfer application (SFTP). Fugu allows you to take advantage of SFTP's security without having to sacrifice the ease of use found in a GUI. Fugu also includes support for SCP files transfers, and the ability to create secure tunnels through SSH."
 For example,WinSCP defaults to the SFTP protocol. Even when operating in SCP mode, clients like WinSCP are typically not pure SCP clients, as they must use other means to implement the additional functionality (like the ls command). This in turn brings platform-dependency problems.

  •  FireFtp: It's a plug-in for Firefox (that means it's cross-platform). But FireFTP is an FTP client, not an SCP/SSH client.
  • FireSSH is a free, cross-platform SSH terminal client for Mozilla Firefox. Written entirely in Javascript!
  • Secure Shell is an xterm-compatible terminal emulator and stand-alone ssh client for Chrome. It uses Native-Client to connect directly to ssh servers without the need for external proxies.

  • cross-platform file manager with a dual-pane interface. It runs on any operating system with Java support
Moreover you can always transfer your files using a terminal. For example using the following command will transfer a file from your mac to a remote server using the scp command: 


scp -P portnum -i path/to/keyfile path/to/file_you_are_uploading user@server:path/on/server

-P portnum is the port number of the remote server. If your using port 22 then you don't need to specify a port here. But if you are using a port number other that 22, then place it behind the -P 

-i path/to/keyfile is your private key file. I personally don't use passwords when using ssh/scp instead I use private keys. If you use passwords then dont use the -i statement 


PS: OpenSSH is a FREE version of the SSH connectivity tools that technical users of the Internet rely on. Users of telnet, rlogin, and ftp may not realize that their password is transmitted across the Internet unencrypted, but it is. OpenSSH encrypts all traffic (including passwords) to effectively eliminate eavesdropping, connection hijacking, and other attacks. Additionally, OpenSSH provides secure tunneling capabilities and several authentication methods, and supports all SSH protocol versions.

The OpenSSH suite replaces rlogin and telnet with the ssh program, rcp with scp, and ftp with sftp. Also included is sshd (the server side of the package), and the other utilities like ssh-addssh-agentssh-keysignssh-keyscanssh-keygen and sftp-server.
OpenSSH is developed by the OpenBSD Project. The software is developed in countries that permit cryptography export and is freely useable and re-useable by everyone under a BSD license.

What is SSH Client?

An SSH client is a software which uses the SSH protocol to connect to a remote computer.
In general SSH protocol can be used for two purposes, file transfers and terminal access.
SSH File Transfers
File transfers are primary focus of WinSCP.
WinSCP supports SFTP (SSH File Transfer Protocol) for secure file transfers. In addition to that it also supports legacy SCP (Secure Copy Protocol).
You can use WinSCP to transfer files both manually and automatically.
SSH Terminal Access
While WinSCP does not focus on terminal access, it has basic support for it.
You can execute remote commands via SSH terminal both manually and automatically.

If you need unrestricted terminal access (and still want to use WinSCP for file transfers), you will find integration with PuTTY SSH client useful. This free Telnet and SSH client for Windows can be also downloaded from our PuTTY download page.

use some programs (Mathematica e.g.):
ssh servername requires an interactive terminal, which you cannot expect Mathematica to give you. How about doing ssh servername command  ,  which will actually run the command you want, then return. That doesn't require an interactive terminal.

Connexion à des supercomputers (CINES)

Connexion au CINES

A quoi sert SSH ?
SSH permet d’obtenir un shell distant de façon sécurisée contrairement à rsh. Il permet de remédier aux problèmes qui sont :
  • éviter la circulation des mots de passe « en clair » sur le réseau
  • avoir une authentification renforcée des machines, pas seulement basée sur le nom ou l’adresse IP
  • exécuter en toute sécurité des commandes à distance
  • transférer des fichiers de manière sécurisée
  • sécuriser les sessions X11, très vulnérables
il existe SSH :
  • remplacement pour la plus part des R-commandes :
    • ssh remplace rsh, rlogin et telnet,
    • scp remplace rcp,
    • sftp remplace ftp
  • utilise RSA pour une authentification, basée sur l’algorithmique cryptographique à clés publiques entre machines et utilisateurs ;
  • permettre de rediriger tous flux TCP dans le « tunnel » de la session, et en particulier X11 qui peut l’être automatiquement ;
  • chiffrer le tunnel, et au besoin et sur demande, le compresser.
SERVEUR : c’est le logiciel Openssh qui est disponible sur nos machines ; il répond à la fois à la version V1 et V2 du protocole SSH. (voir
CLIENT : la machine client, serveur unix ou poste de travail Windows doit disposer d’un client SSH. Il existe de nombreux logiciels (Putty, SSH Secure File Transfer Client…) dont certains sont gratuits (voir openssh).
ssh s’utilise comme les utilitaires unix rsh, rlogin, rcp, etc…
Plusieurs types de connexions sont possibles :
1/ Se connecter d’un site extérieur (France ou étranger) sur le CINES : Si vous avez à vous connecter sur une des machines du CINES (voir liste des machines), à partir d’un site extérieur, par exemple sur la machine leda :
ssh –l user

2/ Copie de fichiers du CINES sur une machine distante Pour copier un fichier de yoda sur une machine distante sur laquelle vous êtes enregistré faut utiliser la commande scp (comme SSH copy). Votre mot de passe sur la machine distante vous sera demandé :
scp fichier.yoda user@:fichier.distant

3/ Copie de fichiers d’une machine distante sur une machine du CINES Pour récupier un fichier d’une machine distante et le copier sur yoda :
scp user@:fichier.distant fichier.yoda

Connexion à la machine

Elle s’effectue en ssh sur

CINES supercomputing, Activity of supercomputer and available softwares

Disponibilité et activité des machines de calcul :

tous les logiciels installés disposent d’un module. Il est possible d’utiliser la commande module avail pour connaître l’ensemble des modules installés sur la machine.

Comment utiliser un logiciel ? La commande module

La commande module peut être utilisée des manières suivantes :
  • module avail  liste l’ensemble des modules installés sur la machine (par ex. abinit).
  • module load nom_module permet d’ajouter le module à la session en cours (par ex. module load abinit).
  • module show nom_module donne des informations sur le module (version, conflit avec d’autres modules, etc..).
  • module list liste l’ensemble des modules chargés pour la session en cours.
Une fois la commande module load nom_module utilisée, vous pouvez utiliser le logiciel correspondant.