Terminal access in Linux

Command Prompt and Getting Prompts Back

A command prompt is a small text at the beginning of the command line followed by the symbol of the prompt on a command-line interface. It is often called a prompt. Once we open the terminal from our Linux machine, we shall get the prompt.

virtual-box70

  • The first part of the entire command (saby) is the username.
  • The second part of the entire command (ubuntu) is the hostname.
  • The third part of the entire command ($) is the prompt symbol.
We shall get the # symbol as a command prompt if we are logged in as root user. For any user other than root, the $ symbol is used as a command prompt. This structure can be reconfigured or changed as well at the profile level.

If you're stuck at any point while running a command, we can get back to the command prompt with the Ctrl + c command.

Download and Install Putty

To access the terminal of the Linux system, we can also use the putty. Putty just works as the terminal of the Remote machine from the local machine.

  • Navigate to the link: https://www.chiark.greenend.org.uk/~sgtatham/puttyml/latest.ht.
  • The Package files are available for Windows and Unix. Windows users click on the 64 or 32-bit link based on your system.
    linux-logo11
  • Save the file.
  • Once the download is completed, double click on the file and click on Run.
  • The Destination Folder pop up comes with the default location of the Putty folder. We can also change the location.

virtual-box72

  • Click on Next.
  • The Product Features pop up comes where we can select the features to be installed. Click on Install.

virtual-box73

  • Once the installation is completed, we shall get the message along with the option to view the README file. Click on Finish.

virtual-box74

Congratulations!! We have successfully installed Putty and a shortcut of Putty gets created.

Mac users do not need to install Putty. You have to open up a terminal and execute the command ssh -l <username> <IP address of Linux machine>.

Connect Putty to Linux Terminal

To know the IP address, the command is:(This is for CentOS/Redhat 5 or 6).

ifconfig
[OR]
ip

For the CentOS/Redhat 7, the command ifconfig gets replaced with ip. From the CentOS/Redhat 7.5 and above, the ifconfig command has been deprecated.

So if we are using Redhat or CentOS 7.5 version, we have run the command ip addr to get the list of all IPs. With Redhat or CentOS 7.5, if we want to use the ifconfig command we have to install a package called net-tools. The complete command is yum install net-tools.

Connect Linux VM terminal via Putty

Let us execute the command ip addr command from the command prompt. The IP address gets listed out. Now launch the Putty by double-clicking on it.

Enter the IP address we just obtained by running the ip addr command. The Port field gets populated by default. Enter the machine name in the Saved Sessions field. Click on Save. Then click on Open.

virtual-box75

The Putty Security Alert pop up comes up. Click on Yes.

virtual-box76

The Putty terminal screen opens up where we have to input our credentials. This is now similar to the GUI login which we have done earlier. If the GUI environment is not set up, we have to depend on Putty to work with Linux.

Issues Connecting Linux VM Through Putty

Some of the ways to troubleshoot issues while connecting Linux VM through Putty are:

  • NIC setting on Oracle virtual Box.
    In Oracle virtual box manager, select the machine then click on Settings.

linux-puttyissue

Go to the Network tab, and check that Enable Network Adapter is checked. Also, verify if the Host-only Adapter option is selected. linux-puttyissue2

It is also ok if we choose the option Bridge Adapter. If we are using a wireless connection like wifi, we need to select the Band Wireless option from the Name dropdown.
linux-puttyissue4

If we are connected through the Ethernet cable, we need to select the Ethernet Connection option from the Name dropdown.
linux-puttyissue5

  • Network service is down at the OS level.

Log in to the Linux machine, run the command ifconfig. Verify the IP address and status should be RUNNING. linux-puttyissue3

If the IP address and status is not populated, we have to restart the network service by running the command:

systemctl restart network.service
  • Advanced NIC setting on Oracle virtual box.

In Oracle virtual box manager, select the machine then click on Settings.
linux-puttyissue

Go to the Network tab, click on Advanced. All the information should be populated. linux-puttyissue6

  • SSH daemon is not running.

Verify if the SSH daemon is running with the command:

ps -ef | grep ssh
Important points to remember in Linux:
  • Linux is case sensitive.
  • Linux file names should not have spaces.
  • Linux has an administrator account known as root.
  • The root account has many features like creation, modification, deletion of accounts. It can also change the configuration files.
About Author :

Myself Debomita Bhattacharjee, an IT employee with 6+ years of experience in Software industry. My area of interest is Automation testing and Front End Development.

Comment / Suggestion Section
Point our Mistakes and Post Your Suggestions