Virtually all Unix systems allow users to log in and run programs over a network from other locations. This feature is intrinsic to Unix systems, and only disabled on certain proprietary or embedded installations. It is possible to use both GUIs and CLIs in this fashion, although GUIs may not work well over slow connections such as a typical home Internet service. Different graphical programs have vastly different video speed demands. Some will work fine over a DSL connection, while others will not work well even over the fastest network.
The command line interface, on the other hand, works comfortably on even the slowest network connections.
Logging into a Unix CLI from a remote location is usually done using Secure Shell (SSH).
If you want to remotely log in from one Unix system to another, you can simply use the ssh command from the command line. The general syntax of the ssh command is:
ssh [flags] login-id@hostname
-X(enable X11 forwarding) or
-Y(enable trusted X11 forwarding) flag in your ssh command.
-Yonly when connecting to trusted computers, i.e. those managed by you or someone you trust. These options allow the remote system to access your display, which can pose a security risk.
shell-prompt: ssh firstname.lastname@example.org shell-prompt: ssh email@example.com
Once logged in, you can easily open additional terminals from the command-line if you know the name of the terminal emulator. Simply type the name of the terminal emulator, followed by an '&' to put it in the background. ( See Section 1.19.3, “Internal Shell Commands and Symbols” for a full explanation of background jobs. ) Some common terminal emulators are xterm, rxvt, gnome-terminal, xfce-terminal, konsole, and Terminal.
shell-prompt: xfce-terminal &
If you're connecting to a Unix system from a Windows system, you will need to install some additional software.
The Cygwin Unix-compatibility system is free, quick and easy to install, and equips a Windows computer with most common Unix commands, including a Unix-style Terminal emulator. Once Cygwin is installed, you can open a Cygwin terminal on your Windows desktop and use the ssh command as shown above.
The Cygwin installation is very quick and easy and is described in Section 1.5.1, “Cygwin: Try This First”.
A more limited method for remotely accessing Unix systems is to install a stand-alone terminal emulator, such as PuTTY, http://www.chiark.greenend.org.uk/~sgtatham/putty/. PuTTY has a built-in ssh client, and a graphical dialog box for connecting to a remote machine. To connect via ssh, simply select the ssh radio button, enter the hostname of the computer you want to connect to, and click the Open button.
Connections to specific machines can be saved. First, enter the host name in the "Host Name" box and a name of your choice in the "Saved Sessions" box:
In order for terminal-based programs to function properly, they must know what type of terminal or terminal emulator you are using. Most terminal emulators are based on the "xterm" terminal type, and programs will mostly work if you tell the remote system you are using an xterm. Some special keys and graphic characters may not work properly, though. For best results with PuTTY, go to the "Data" section under "Connection" and change the terminal type that PuTTY reports from "xterm" to "putty":
Then go back to the "Session" screen and click "Save" to add this connection to the saved sessions.
Once you've saved the session, you can click on the name once and then click "Open", or just double click on the name.
The first time you connect to a system using SSH protocol, you will be asked whether you really trust the host to which you are connecting. If you trust it, click "Yes" or "Accept" or "Connect Once". If not, then don't connect to the host.
In some cases, you may be asked to specify a terminal type when you log in:
Terminal features such as cursor movement and color changes are triggered by sending special codes (characters or character combinations) to the terminal. Pressing keys on the terminal sends codes from the terminal to the computer.
Different types of terminals use different key and screen control codes. PuTTY and most other terminal emulators emulate an "xterm" terminal, so if asked, just type the string "xterm" (without the quotes).
If you fail to set the terminal type, some programs such as text editors will not function. They may garble the screen and fail to recognize special keys such as arrows, page-up, etc. Programs such as ls that simple output a line and then go to the next will generally work fine even if TERM is not set.
You can set the terminal type after logging in, but the methods for doing this vary according to which shell you use, so you may just want to log out and remember to set the terminal type when you log back in.
Remotely log into another Unix system using the ssh command or PuTTY. Then try starting the vi editor:
shell-prompt: ls shell-prompt: ls / shell-prompt: ls -al shell-prompt: mkdir -p Data/IRC shell-prompt: cd Data/IRC shell-prompt: nano sample.txt Type in some text, then save the file (press Ctrl+o), and exit nano (press Ctrl+x). shell-prompt: ls shell-prompt: cat sample.txt shell-prompt: wc sample.txt shell-prompt: whoami shell-prompt: hostname shell-prompt: uname shell-prompt: date shell-prompt: cal shell-prompt: cal nov 2018 shell-prompt: bc -l scale=50 sqrt(2) 8^2 2^8 a=1 b=2 c=1 (-b+sqrt(b^2-4*a*c))/2*a 2*a quit shell-prompt: w shell-prompt: ls /bin