• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

The Urban Penguin

The Urban Penguin - Linux Training

  • Home
  • About
  • Live Online Courses
  • Shop
  • Programming
    • Master Editing Text Files Using VIM
    • Learn Shell Scripting with BASH
    • PERL Scripting in Linux
    • Ruby Scripting in Linux
    • Scripting with PowerShell
    • Learn C Programming using Linux and the Raspberry Pi
    • General Java Tutorials
    • Java 7 OCA Exam 1ZO-803
  • OS Tutorials
    • Red Hat and CentOS Training
      • Red Hat Enterprise Linux System Administration 1 – RH124
      • RHCSA – System Admin 2 – RH134
      • RHCE – EX294 – Automation With Ansible
    • Learning Ubuntu
    • LPI Training
      • LPI Linux Essentials
      • LPIC-1 Linux Administrator
      • LPIC-2 Certified Linux Engineer
      • LPIC-3 Senior Level Certification
        • LPIC-3 Exam 300 : Mixed Environments
        • LPIC-3 Exam 303 : Security
        • LPIC-3 Exam 304 : Virtualization and High Availability
    • Linux Technologies
      • Apache HTTPD Server
      • Learning PHP
      • Learning PUPPET
      • Learning SAMBA
      • Linux File-Systems
      • Monitoring with Nagios Core
      • MYSQL
      • openLDAP Directories on Linux
You are here: Home / Linux / CentOS / Access the Command Line in CentOS 7

Access the Command Line in CentOS 7

July 11, 2014 by The Urban Penguin

centos7Pretty much the first task that we are going to be presented with on Linux is to log in. We are going to need to know how to access the command line in CentOS 7 to. get the most out of the OS. Hence this is the first objective in the RH124 course. So we will take a look at how we can log in the the GUI and Terminal and how we can gain access to the command line interface or CLI.

The CLI will always be important in Enterprise Linux as many servers will not have a GUI and you will gain access not from the Server itself but in many cases using SSH from your client, perhaps PuTTY on windows. If we do have access to the server or desktop and it does have a GUI we can gain access to the command line via the GUI and pseudo terminals or directory on a physical console.

We start by logging in to the GUI Gnome environment that CentOS installs by default if the desktop is selected. The username is display to us so this is not an issue in the GUI but if logging into to a console be aware that the username and password are both case-sensitive in Linux.

Once we have logged in we can gain access to the command line by right-clicking the desktop and choosing “Open in terminal“. The Desktop folder will then be our file-system context from the command line using the gnome-terminal. We could also start the terminal via the Menu: Applications > Utilities > Terminal. Yet another mechanism would be to use ALT + F2 and type gnome-terminal as the command to run, the ALT+F2 run dialog is shown in the next graphic:

Access the command line in CentOS 7

Once we have a terminal open the great thing with the GUI terminal is that we can increase the size of the font: CTRL + SHIFT + + and reduce with CTRL + – . To full screen the terminal we are in, we can use F11

If we enter the command tty at the console then it most likely will show as /dev/pts/0 (unless other pseudo terminals are in use). This is a file in the filesystem but links directly to the console that we are in. We can see this is we enter the following command:

$ echo "hello" > /dev/pts/0

We send the word hello to the file using redirection. As the file repesents the terminal we see the word in our terminal. If you are still a little unsure as to the terminal you are connect to. Then we can combine the echo command with the tty command:

$ echo "hello" > $(tty)

This will work no matter the TTY you are connected to. We first evaluate the output of the tty command. Brackets are processed first. We can then pass that through to the redirection form the command echo. You will see hello being printed out on your terminal.

We also have physical terminals on the device. /dev/tty1 is used by the GUI but that leaves /dev/tty2 – 6 . We can access these using CTRL + ALT + F2 to access the tty2 and F3, to access tty3 etc.

We can login in to the physical consoles and again use the tty command to display the terminal name. To return to the GUI we can use CTRL + ALT + F1. Do not forget though that we will need to logout from any terminal. We can do this using:

  • exit
  • logout
  • CTRL + d

To check where we are logged into and who else is logged in, we can use the command who.

Share this:

  • Click to share on Twitter (Opens in new window)
  • Click to share on Facebook (Opens in new window)
  • Click to share on LinkedIn (Opens in new window)
  • Click to share on Reddit (Opens in new window)
  • Click to share on Pinterest (Opens in new window)
  • Click to share on Tumblr (Opens in new window)
  • Click to print (Opens in new window)

Filed Under: CentOS, RH124

Primary Sidebar

Newest Video

The Urban Penguin On Youtube

Categories

Pages

  • About The Urban Penguin
  • Contact Us
  • Shop
    • Basket
    • Checkout
    • My Account
  • LPI Training from The Urban Penguin
    • Live and Pluralsight hosted courses
    • Complete Linux Essentials
    • LPIC-3 Senior Level Certification
      • LPIC-3 Exam 300 : Mixed Environments
      • LPIC-3 Exam 303 : Security
      • LPIC-3 Exam 304 : Virtualization and High Availability
    • LPIC-2 Certified Linux Engineer
    • LPIC-1 Linux Administrator
    • LPI Linux Essentials for Raspberry Pi
    • LPI Linux Essentials
  • Operating System Tutorials
    • Linux Foundation Training
    • Solaris 11 OCA 1ZO-821
    • Learning Ubuntu
    • Learning SUSE
    • Red Hat and CentOS Training
      • RHCE – EX294 – Automation With Ansible
      • RHCSA – System Admin 1 – RH124
      • RHCSA – System Admin 2 – RH134
  • Scripting – the power of repetition!
    • Java 7 OCA Exam 1ZO-803
    • General Java Tutorials
    • Learn C Programming using Linux and the Raspberry Pi
    • Ruby Scripting in Linux
    • Scripting with PowerShell
    • PERL Scripting in Linux
    • Learn Shell Scripting with BASH
    • Master Editing Text Files Using VIM
  • Linux Technologies
    • Learning PUPPET
    • openLDAP Directories on Linux
    • Monitoring with Nagios Core
    • Linux File-Systems
    • Learning SAMBA
    • Apache HTTPD Server
    • Learning PHP
    • MYSQL
  • OpenStack
    • Pluralsight
    • Udemy
    • Raspberry Pi Tutorials
    • Citrix Videos
  • Online Instructor-led Courses
    • Red Hat Enterprise Linux System Administration 1 – RH124
    • SELinux Masterclass
    • Bash Scripting Masterclass
    • Nftables Masterclass

© 2021 The Urban Penguin · All Rights Reserved