Get access to the command-line interface in Linux and macOS

Command-line interface functions almost identical for both macOS and Linux. Not surprisingly though, since both of these operating system are UNIX-based operating systems. This article will show you how you can get to the command-line interface on these systems.

Terminals

For macOS, the interface is a terminal emulator. What do I mean by terminal emulator here is, the emulator in macOS is a replica of the classic terminal to keep things easy. On macOS, this is called a Terminal. As for the Linux distros, the name of the emulators are different, there are names like GNOME terminal, Console Terminal.

Getting to the terminal on macOS

For our purpose, let’s keep it simple and use the GUI-based Linux Ubuntu and use the Terminal. Yet, before Ubuntu, let’s open the terminal in macOS. You can do so by launching the terminal app from the utilities folder, which can be found inside Applications folder or activate spotlight and type terminal and hit enter. Spotlight is macOS’s iconic search tool. This is one of the most powerful search tool in operating systems. This should bring up the mighty macOS Terminal.

Remember command-line-interpreter for UNIX-based operating system is called Bash. So, you will see the name on the top.

Getting to the terminal on Linux

Now for Linux users, the way you can open up the terminal emulator depends solely on the distro you will be using. Typically any desktop-focused, GUI-based, Linux system, you will have some sort of a search tool available to you, just like Windows and macOS.

It should not be difficult at all to locate the search bar. Once you find it, type terminal and hit enter. This should start the terminal.

As for the UNIX operating system, you can run the command line with elevated privilege called super user or root privilege. To run the command line as such elevated privileged user, you need to know two command for each of the operating system, respectively.

One, su and the other sudo. One thing  you should keep in mind that, even though the macOS and Linux advanced privilege is similar to that of windows elevated privilege, they do have their difference and works differently to some point.

Running terminal with an administrator privilege

Now, whenever you need to run a command as administrator privilege, just type sudo and type in your command. This will run the command as administrator privilege. As for such sudo command, a password will be prompted and then the command will be executed.

If, in any case, the system fail to recognise command like sudo, probably the system relies on the older sibling of sudo , which is su. Type in su followed by your command. By doing so, you will see the symbol changes from $ to #. This is to indicate that now your every command will be run as root user which is from the system root. Whereas, the sudo command will execute commands as the root user from the root folder of the current user.

Once you are done working as a root user, simply type exit and hit enter. Notice that upon exiting like this, unlike windows CLI, the prompt box won’t close, rather log you out of the terminal as a root user and set you as regular user by changing the symbol from the # to $ again.