Get started with Shell & Linux commands Line

Subscribe to my newsletter and never miss my upcoming articles

Unix has retarded OS research by 10 years and Linux by 20 years.

--Dennis Ritchie--


Many decades earlier and until nowadays, the Shell program not only used but also among the ideally operating system where developers build their projects. Shell was the only user interface on Unix-like system to interact with the OS. Based on this fact, I think it's worth understanding how this program works and how to use CL (command line) to run tasks from the Terminal.

Overview

  • What is Shell and how it works

  • Why should you care about such OS

  • Explore basic shell Commands Line:

      1. Navigation
      2. Look around
      3. Manipulating files
  • Extras


What is Shell and how it works

In this blog, I'll keep things simple just to let you know the basics of the Shell environment, I will not go deep into its definition, and the historical release of Shell, and deep dive into all Linux command line. However, if you want to go deeper I'll suggest that you refer to this document. Shell provides an interface between a user and the OS kernel. The Kernel is the core component of the OS, controls low-level tasks such as

  • Disk management
  • Memory management

The main Shell feature is to take commands from the keyboard inputs and gives them to the OS to execute. There are many kinds of Shell already exists:

By linking with the kernel, the Shell enables a user to execute utilities and programs. To perform these tasks, we use a Terminal. A terminal is a program and called also an emulator. Within its window you can interact with Shell, so for this blog all command lines we'll see and test pass through it.

Why should you care about such OS

If you google such a question to find the answer you'll find a lot of answers that'll amaze you, but let me show you in a few words why you should care:

  • First, Linux is widely used, and it's always ranked in the top of the most OS used.
  • With an extensive amount of network operating systems based on Linux and the number of Linux-based projects like OpenStack growing, Linux skills are a requirement for the networking professional.
  • So faster that you can't imagine, provides less typing commands to perform tasks for example:
    project $ mkdir dir3
    project $ cd !$
    cd dir3
    project/dir3 $
    
    Represent the most tricky and short solution for enormous problems, for example:
    mkfs.ext3 /dev/hda
    
    This command formats the hard drive to use the ext3 filesystem. Disk drive formatting is not an inherently malicious action, but it does "reset" the drive such that it's as good as new. A formatted hard drive is like a blank slate. Formatting is useful for disk partitions, and external drives, but executing it on an entire hard drive is very ### dangerous. Feel free to dive deep here.

Explore basic shell Commands Line

1 - Navigation:

Within the Linux filesystem, files are arranged in what we call hierarchical directory structure, which is means that it's organized in a directories tree. A directory may include subdirectories and files. In this part, we'll navigate within directories using 3 essential commands.

  • pwd (print working directory):

This command enables us to represent a full pathname of the current working directory we work on.

  • cd (change directory):

To change the working directory we use the cd command.

  • ls (list):

This command is used to list the contents of a directory.

2 - Look around:

After we know how to change our working directory and list all its subdirectories, let's take a tour within files:

  • less:

less is used to view the contents of a text file one screen at a time. Allowing both forward and backward navigation through the file. (to return to the initial Shell window hit "q").

  • file:

This examines a file and prints the what of file it is.

3 - Manipulating files:

Among the frequent commands line used are: mkdir, touch, cp, mv and rm

  • mkdir:

This command is used to create directories, notice that it can support the creation of several directories in one time.

  • touch:

This allows you to create new files.

  • cp (copy):

This command enables you to copy files and directory, notice the option "-r" used to copy the subdirectory_1.

  • mv (move):

The "mv" command allows you to move files and directories within other directories.

  • rm (remove):

This command allows removing either files or directories.

Extras

  • Ctrl+L: Clear the screen. This is like running the “clear” command.

  • Ctrl+S: Stop all output to the screen. This is useful when running commands with a lot of long, verbose output,

  • Ctrl+C: useful when you want to stop or cancel a process.

  • Ctrl+Q: Resume output to the screen after stopping it with Ctrl+S.


Hope that my blog will be your kick-start path with the Linux command line, and just remember that's up to you to dive deep within the Linux commands line learning path.

No Comments Yet