Putty Commands Cheat Sheet

Advertisement

Putty commands cheat sheet is an essential tool for anyone who frequently interacts with remote systems via SSH (Secure Shell) and Telnet. Putty is a free and open-source terminal emulator, serial console, and network file transfer application that allows users to connect to remote servers securely. This cheat sheet will cover fundamental Putty commands, configuration tips, and some advanced functionalities that can enhance your productivity.

Understanding Putty Basics



Before diving into specific commands, it’s crucial to understand what Putty is and how it operates. Putty is primarily used for:

- SSH Connections: Securely connecting to remote servers.
- Telnet Connections: Connecting to servers without encryption (not recommended for sensitive data).
- Serial Connections: Communicating with devices like routers or switches.
- SFTP: Secure File Transfer Protocol for transferring files securely.

Installation and Setup



Installing Putty is straightforward:

1. Download the Putty installer from the official website.
2. Run the installer and follow the on-screen instructions.
3. Once installed, you can launch Putty from your desktop or start menu.

When you first open Putty, you will see a configuration window. The following fields are crucial for setting up your connection:

- Host Name (or IP address): The hostname or IP address of the server you wish to connect to.
- Port: The port number; the default for SSH is 22, while Telnet usually uses port 23.
- Connection Type: Choose between SSH, Telnet, Rlogin, or Serial.

Basic Putty Commands



Once you have established a connection using Putty, you will be interacting with a command-line interface. Here are some of the most commonly used commands:

1. Navigational Commands



- `cd `: Change the current directory to the specified directory.
- `ls`: List files and directories in the current directory.
- `pwd`: Print the current working directory.
- `mkdir `: Create a new directory.
- `rmdir `: Remove an empty directory.

2. File Management Commands



- `touch `: Create a new, empty file.
- `nano `: Open a file in the Nano text editor.
- `cat `: Display the content of a file.
- `cp `: Copy files or directories.
- `mv `: Move or rename files or directories.
- `rm `: Delete a file.
- `rm -r `: Recursively delete a directory and its contents.

3. System Information Commands



- `top`: Display running processes in real-time.
- `htop`: An enhanced version of `top` (if installed).
- `df -h`: Show disk space usage in a human-readable format.
- `free -m`: Display memory usage in megabytes.
- `uname -a`: Show system information, including kernel version.

4. Network Commands



- `ping `: Check connectivity to a host.
- `ifconfig`: Display network interface configuration (for older systems).
- `ip addr`: Display network interface configuration (for modern systems).
- `netstat -tuln`: Show active connections and listening ports.

Advanced Putty Features



Putty also offers several advanced features that can enhance your usage experience.

1. Session Management



Putty allows you to save your configurations for easier future access:

1. Save Session:
- Enter your hostname and port.
- Under "Saved Sessions," enter a name and click "Save."
2. Load Session:
- Select a saved session from the list and click "Load."

2. Customizing Appearance



You can customize the appearance of your Putty window:

- Change Font: Go to the "Window" category, then "Fonts." Choose your desired font and size.
- Change Background Color: Under "Window," select "Colours" and adjust the background and foreground colors.
- Adjust Window Size: Set the number of rows and columns in the "Window" category.

3. Using Key Pairs for Authentication



For secure connections, it’s advisable to use SSH keys instead of passwords:

1. Generate Key Pair: Use Puttygen (included with Putty) to create a public/private key pair.
2. Save the Keys: Save the private key securely and copy the public key to your server (usually in `~/.ssh/authorized_keys`).
3. Configure Putty: In the Putty configuration window, navigate to "Connection" > "SSH" > "Auth," and browse for your private key file.

4. File Transfer with PSCP and PSFTP



Putty includes command-line tools for transferring files:

- PSCP: Securely copy files between your local machine and remote server.
- `pscp @:`

- PSFTP: An SFTP client for transferring files interactively.
- `psftp @`

Troubleshooting Common Issues



Even with a solid understanding of Putty commands, you may encounter issues. Here are some common problems and solutions:

1. Connection Refused



- Ensure that the server is up and running.
- Check if the SSH or Telnet service is enabled on the server.
- Verify that you are using the correct port.

2. Timeout Errors



- Check your internet connection.
- Ensure that the server's firewall is not blocking your connection.

3. Authentication Failures



- Verify your username and password.
- Ensure your SSH key is correctly installed on the server.

Conclusion



A Putty commands cheat sheet is a valuable resource for both beginners and seasoned professionals. By mastering the commands and features outlined in this article, you can significantly enhance your productivity while working with remote servers. Remember to regularly update your knowledge, as both Putty and the associated technologies continue to evolve. With practice, the use of Putty will become second nature, enabling you to manage your server environments effectively and efficiently.

Frequently Asked Questions


What is a putty commands cheat sheet?

A putty commands cheat sheet is a quick reference guide that lists commonly used commands and shortcuts for the PuTTY terminal emulator, helping users efficiently manage their SSH sessions.

How do I connect to a remote server using PuTTY?

To connect to a remote server using PuTTY, open the application, enter the server's IP address or hostname in the 'Host Name' field, choose the SSH protocol, and click 'Open' to initiate the connection.

What are some common commands used in a PuTTY session?

Common commands include 'ls' (list directory contents), 'cd' (change directory), 'mkdir' (make directory), 'rm' (remove files or directories), and 'exit' (close the session).

Can I save my session settings in PuTTY?

Yes, you can save your session settings in PuTTY by entering a name in the 'Saved Sessions' box and clicking the 'Save' button, allowing you to quickly reconnect with the same configuration.

What is the purpose of the 'ssh-keygen' command?

The 'ssh-keygen' command is used to generate, manage, and convert authentication keys for SSH, enhancing security by allowing passwordless logins to remote servers.

How do I copy text from PuTTY to my clipboard?

To copy text from PuTTY, simply highlight the text with your mouse; it will automatically be copied to the clipboard. You can then paste it using 'Ctrl + V' in other applications.

What is the difference between 'scp' and 'sftp' commands in PuTTY?

'scp' (Secure Copy Protocol) is used for securely transferring files between hosts on a network, while 'sftp' (SSH File Transfer Protocol) provides a secure way to access, manage, and transfer files over SSH.