Basic Linux Command Lines.



Table of Contents

1.Introduction.

What is a Linux shell?

A Linux shell or terminal is a command line interpreter (CLI) program or environment that enables users to interact with the Linux operating system by entering text-based commands and scripts. The shell serves as an intermediary between the user and the Linux kernel, which is the core of the operating system responsible for managing hardware resources and running processes. The most commonly used shell in Linux is called Bash.

How to write a command in Linux?

First off, you need to open your shell or terminal on your Ubuntu virtual machine using VirtualBox.

To do so, click on "Show Applications" on the bottom left corner of your Ubuntu desktop.


Search for "Terminal" and click on the icon to open it.


This is how a shell or terminal looks like once opened.


You can then simply type in any command, some of which are explained below.

If you have not already installed and run Ubuntu on VirtualBox on your computer, check out the link below.


2.Basic Linux Commands. 

Here are some basic Linux commands that may help you navigate and perform some common tasks on the Linux terminal.

Note: Linux commands are case sensitive.

1.ls (List)
 The 'ls' command is used to list all the files and directories in the current working directory.


There are also some other variations of the 'ls' command:

(i) ls -l

This command provides a long listing format that includes detailed information about files and directories such as permissions, owner, group, size, and modification date.
 

(ii) ls-a

This command shows hidden files and directories (those starting with a dot '.').

 

(iii) ls -al

This command displays a list of all files and directories in a long format, including hidden ones.


2.cd (Change Directory)

The 'cd' command is used for navigation between the current working directory to a different directory or specified location.

For example: Change to a directory named 'Downloads'.


There are also some other variations of the 'cd' command:

(i) cd ..

This command is used to navigate to the parent directory (one level up) of your current location.
 
 

(ii) cd /

This command is used to navigate to the root directory, the top-level directory in the Linux file system hierarchy.

 

(iii) c ~

This command is used to navigate to the home directory from the current directory.

    3.pwd (Print Working Directory)

    The 'pwd' command is used to display the absolute path of the current directory. This can be helpful for understanding your current location in the file system and specifying file or directory paths in other commands.


    Here, /home/jevin31 is the path of the current directory.

    4.mkdir (Make Directory)

    The 'mkdir' command is used to create a new directory with a specified name in the current working directory.

    For example: Create a directory named 'test_directory' in the current location.


    There are also some other variations of the 'mkdir' command:

    (i) -p

    This command is used to create a directory and its parent directory (if they do not already exist).

    For example: Create a new directory named 'my_file' inside a directory named 'my_folder' where 'my_folder' directory does not exist.
     
     

    As seen above, 'my_file' and 'my_folder' were created and 'my_file' is inside the parent directory 'my_folder'.
     
    (ii) Create multiple directories in a single command.

    You can create multiple directories in a single line using the 'mkdir' command followed by the names of the directories you want to create. You should simply separate the names with a space ' '.
     
    For example: Create 3 directories named dir1, dir2 and dir3 in the current directory.

     


    Note: All these commands can be used on any Linux distribution.

    3.Conclusion.

    I hope this short list of basic Linux command lines help you get started. These are just a handful of the commands available. You will eventually come across more such commands over time. The best way to learn Linux us by experimenting with those commands. So, go ahead and start by try these yourself!

    Comments

    Popular posts from this blog

    How to Install & Configure Git on Ubuntu

    How to Install Ubuntu on VirtualBox on Windows 11.