4 min read

Linux: Beginner's Guide 1

Introduction to Linux OS - Beginner's guide 1

Learn Linux Commands and its functions


What is CLI & GUI ?

In my previous post we looked into Linux Operating System, and the functionality of the OS behind the screen. In this post we will learn how to interact with the Linux OS using Command Line Interface (CLI).

CLI can be intimidating at start with a with a with a blinking cursor on black windows. We will take small steps at a time to learn each and individual aspects of it. In contrast to CLI, we have Graphics User Interface (GUI) which is also known as Windows Environment, where users are presented with beautiful icons and graphics to navigate the OS.

Although GUI is more user friendly with graphics and icons, It would take longer to do simple that can be easily done with couple of lines of commands in CLI.

Let's find out more about Command Line Interface (Terminal) and their commands. One thing to be bear in mind that Linux is case sensitive, and it wouldn't recognise case insensitive.

Getting to know Linux CLI

As discussed on pervious post Intro to Linux Terminal acts like a intermediate program that takes users commands then process it to hardware, which then returns the output.

Terminal can do everything that can be done through GUI, just with few line of code and quicker

Once you have installed  your favourite flower of Linux operating system, you can navigate you to Terminal (CLI) by pressing Ctrl + Alt + T on your keyboard.

Command Line Interface (Terminal)

Now we have looked at what those characters means, let's see if this changes when we switch to different user.

Super User (SU) Also known as Root User

As you can see in the picture above, the name of the user changed from regular user to root, also If you notice, dollar sign is changed to # symbol to represent the root user. Changes also reflects on Terminal window at the top.

Exiting Super User (SU) by typing "exit" on Terminal
Symbol Represent
~ Home directory
/ Root directory
# Root user
$ Regular user

Root accounts are only to be used when managing the system e.g. system update, back-up .etc. This is not to be used as a standard user as any command can run as root admin without any safe guard, this could be deleting system files, users etc.

Types of Users in Linux

In Linux, there are 3 types of users.

  1. Superuser / Root User: This account used by Linux System administrators to manage the system, who has highest access rights.

  2. System User : System users are created by applications and software's when installing the software packages. This used for system services and processes to be ran in background, also known as non-interactive process.

  3.    Standard User: Standard accounts are created by root users, as well as they have privilege to delete any accounts.

Linux File System

The Filesystem Hierarchy Standard (FHS)  defines the directory structure of the a UNIX Operating System. It is maintained by the Linux Foundation. The following diagram shows the file structure on Linux distributions and lists of files contents and their functionalities.

Linux File Hierarchy. Imaged sourced from -www.serverkaka.com
Path Description
/ (Root) Primary directory of the entire file system. All the sub-folders and files falls under root directory
/bin Essential Command binaries that is available in single user mode. including to bring up the system or repair it. e.g. ping
/boot Boot loader files (e.g kernels, initrd (load temp root FS as part of the bootup)
/dev Essential device files, e.g /dev/disk0. This includes USB, devices attached to files.
/etc Host-specific system-wide configuration files. Contains configuration files required by the programs
/home Users' home directories, containing saved files, personal settings, etc. Home directories for all the users in the system.
/lib Libraries essential for the binaries in /bin and /sbin /Systemd. Library files names are either id* or lib*.so.*
/media Mount point for removeable media such as CD-Roms, CD writer.
/mnt Temporarily mounted files systems, where sysadmin can mount files system
/opt Optional application software packages. Contains add-on application stored on /opt directory. e.g. VLC, Adobe
/sbin Essential system binaries, e.g fsck, init, route. These Linux commands are usually used by System Admin for maintenance.
/srv Srv stands for service. Site specific data servered by this system, such as FTP servers and web servers.
/temp Temporary files. Used by the OS and users to store programs' temp files. Files stored my deleted at any time without prior notice
/usr Shared, read-only files, including executable binaries and libraries for apps and utilities.
/pro Virtual files system providing process and kernel info as files. e.g /proc/uptime command
/run Modern Linux Distros includes a /run directory which stores volatile runtime data that helps to boot up the system. TmpFS.

Let's explore the Linux File System through the simple commands. I have listed some of the most commonly used commands in Linux, however find the video that walks you through all the important commands you will find useful!

Command Function
man Manual or user guide
pwd Print working directory
ls List
cd Change directory
cat Concatenate or view
find Search for files
grep Search content within file