Linux Basic Commands - Part 1

Linux

Linux is an opensource operating system.The kernel of this operating system is written by Linus Torvalds.

Basic Commands:

  1. pwd:

    This command returns the present working directory as output.

    Syntax:- pwd

    Example:

    [user1@node1~] $pwd

    /users/home/user1

  2. ls :

    This command lists the files and directories under the present working directory.

    Syntax: ls -[options]

    Example:

    [user1@node1~]$ls

    bin dev tmp usr

    It can be used with multiple options:

    l - lists in longname

    a - lists all files including hidden files

    R - lists all subdirectories recursively.

    r - lists files in reverse chronological order

    t - lists latest files by modification time

    h- lists all files and directories in human-readable format

  3. <command> --help

    This gives a brief documentation of the command.

    Example:- $ls --help

  4. grep

    This command is used to search pattern in file

    Syntax: grep -[option] pattern file_path

    Example:

    [user1@node1~]$ grep passed /root/tmp/certificate.pdf

    has passed the examination of

    It can be used with multiple options:

    -i: Ignores the case

    -v: Excludes the pattern found

    -E: Extended grep - Regular expressions can be used with patterns

  5. whoami

    This command outputs the username of current user logged in

    Example:

    [user1@node1~]$whoami

    user1