logo

Practical Computing Advice and Tutorials

Sun: 26 May 2019


Site Content

Programming
&
Development


Technical Knowhow


Command Line Interface


Security

The CLI (Command Line Interface)

There are a couple of ways to interact with a computer operating system. In general, most users will be using a GUI (Graphical User Interface), but the CLI will give you much more control. Both GUIs and CLIs are a part of the OS Shell.

You'll, most likely, be used to a GUI, which is an easy and practical way with which to interact with your computer OS and application programmes. What you don't see is what's going on underneath the GUI and you'll only have the options that the designer of the GUI gave you.

You may have heard the term Power User. Generally this term is applied to people for whom the CLI is no big deal; they'll use it day in, day out. If you're a Linux user, it's almost a must have skill.

CMD vs PowerShell

With the Windows OS, there are a couple of options for CLI commands: cmd and PowerShell. You can simply hold down the 'Windows Key' and press 'R' to get a 'Run' command box, from which you can start any application; a nice quick way of starting any app. E.g. If you have MS Office installed, you can very quickly start Word by typing winword. But, PowerShell or cmd will need to be running in Admin Mode for some of the operations. You can click Start, then type either into the search area, then R-Click the app and select 'Run as administrator'.

If you're new to the CLI, start with cmd as you can do much less damage to your system. There are some scripts that you can find on the internet that you can run using PowerShell. I caution you here and now: BE VERY CAREFUL ABOUT WHAT SCRIPT YOU RUN. If you don't fully understand what the script is going to do, or if you or the author has miss-typed something, you could do a lot of damage to the Windows OS: It's called PowerShell for a very good reason.

SSH

I operate two or three other computers at a time all from the one I'm sitting at right now. The other computers have Linux based operating systems, to which I establish a SSH (Secure Shell) connection.

If you're using the Windows 10 OS, you may want to have a look at this link...
https://github.com/PowerShell/Win32-OpenSSH/wiki/TTY-PTY-support-in-Windows-OpenSSH

...but if not you'll need an independent SSH client such as KiTTY

If you're already using a Linux based machine you have a SSH client built-in (OpenSSH) and accessible from the CLI. The command is ssh -l <username> <ip_address> E.g. ssh -l rob 192.168.0.4

The -l option (that's an Ell not a One) and user name are optional, but I find it handy. Also, if you know the hostname of the computer and it's on the same LAN, you can use that name in place of the IP Address.

This will give you a remote CLI screen which can be used in the same way as having direct access to the connected computer. The remote machine could be situated anywhere, from the same room on the same LAN to the other side of the world, accessed via the Internet: it matters not.

If you'd like to see some CLI command examples, have a look at my page on setting up a Raspberry Pi.