Now Hiring: Are you a driven and motivated 1st Line DevOps Support Engineer?

“Linux Administration To Start As A Beginner”

Linux Administration To Start As A Beginner (2)
Tech Articles

“Linux Administration To Start As A Beginner”

WHAT IS LINUX?

Linux is an operating system’s kernel. You might have heard of UNIX. Well, Linux is a UNIX clone. But it was created by “Linus Torvalds”. Linux is free and open- source, that means that you can simply change anything in Linux and redistribute it in your own name!!! There are several Linux Distributions, commonly called “distros”.

  • Ubuntu Linux
  • Red Hat Enterprise Linux
  • Linux Mint
  • Debian
  • Fedora

“All the best people in life seem to like LINUX.”

Steve Wozniak

WHAT IS MEANT BY TERMINAL OR SHELL?

In a nutshell, Linux Terminal is a console similar to CMD or Power Shell (but much more advanced than both).

WHY LINUX INSTEAD OF WINDOWS OS?

As we have discussed above that Linux provides more advance features and is an open source. Well not only Linux but its related applications are also open source. Therefore, users prefer Linux OS as compared to windows OS.

LET’S START WITH BASIC COMMANDS…!!!

LINUX COMMANDS AS ADMINISTRATOR:

  1. Cd command:

DESCRIPTION:Use the “cd” command to go to a directory. For example, if you are in the home folder, and you want to go to the downloads folder, then you can type in “cd Downloads”. Make sure you type cd in lower case as linux is case sensitive.

$cd directoryname

2. Pwd command:

DESCRIPTION:When you first open the terminal, you are in the home directory of your user. To know which directory you are in, you can use the “pwd” command. It gives us the absolute path, which means the path that starts from the root. 

$pwd

3. ls command:

DESCRIPTION: To list all the available files and folder we use ls command using -a tag we can list hidden files and folders as well.

$ls

4.Cat command:

DESCRIPTION:cat command is very frequently used in Linux for different purpose. Well, not going in detail let’s get an overview of the usage. The most common usage of cat command is to create single or multiple files, view content of a file, concatenate files and redirect output in terminal or files.

$cat [filename]

5.Cp command:

DESCRIPTION:cp is a command-line utility for copying files and directories on Unix and Linux systems.

$cp [option] [Source] [destination]

6. Mv command:

DESCRIPTION: Mv command is used to move files and directories from one directory to another or to rename a file or directory. Below is example how a file is moved to directory.

$ mv file1 directory1

7.Mkdir command

DESCRIPTION:mkdir command is used to create directory.

$mkdir [directories ]

8.Rmdir command:

DESCRIPTION: rmdir is a command-line utility for deleting empty directories. It is useful when you want to delete a directory only if it is empty, without needing to check whether the directory is empty or not.

$rmdir dir1

9.Touch command:

DESCRIPTION:Touch command is used to create, change or modify files in directories.

$touch filename

10Locate command:

DESCRIPTION: locate command is used to check whether the locate utility is installed.

$locate [filename]

11.Find command:

DESCRIPTION: Find command have multiple usage. The basic usage is to search for files and directories.

$find (filename)

12.Grep command:

DESCRIPTION:Grep – print lines that match patterns.

$grep [option] patterns [files]

13.Sudo command:

DESCRIPTION: The sudo command allows you to run programs with the security privileges of another user. It executes a file as sudoer.

$Sudo

14.Df command:

DESCRIPTION: To display information related to file systems about total space and available space.

$df [option] [file]

15.Du command:

DESCRIPTION: Allows a user to gain disk usage information quickly.

$du [OPTIONS] [FILE or DIRECTORY NAME]

16.Head command:

DESCRIPTION: In its simplest form, when used without any option, the head command displays the first ten lines.

$head filename.txt

17.Chmod command:

DESCRIPTION: chmod is used to change permission of the file or folder.

$chmod options permissions file name

18.Chown command:

DESCRIPTION: The chown command is used by system adminstrators to change the ownership of files and directories.

$chown [OPTION]. [OWNER] : [GROUP]] FILE.

19.Kill command:

DESCRIPTION: This command is used to end, or we say kill a process.

$killall <process>

20.Top command:

DESCRIPTION: top command is used to show the Linux processes.

$top -n 10

21.History command:

DESCRIPTION: history command is used to get list of all recent commands used in your system.

$history

22.Systemctl command:

DESCRIPTION: A utility which is responsible for examining and controlling the system and service manager.

$Systemctl [service] [option]

23.Apt-get command:

DESCRIPTION: To retrieve the information and packages from the authenticated sources for installation, upgrade and removal of packages along with their dependencies.

$apt-get [option]

24.Ifconfig command:

DESCRIPTION: Displays ip and other configuration of your system.

$ifconfig

25. Reboot command:

DESCRIPTION: Reboot command is used restart or reboot the system.

$reboot [Option]

26.Tar command:

DESCRIPTION:The tar command creates tar files by converting a group of files into an archive. It also can extract tar archives, display a list of the files included in the archive, add additional files to an existing archive, and various other kinds of operations.

The tar command has multiple usage we’ll discuss some in detail,

The general syntax for the tar:

$tar [OPERATION_AND_OPTIONS] [ARCHIVE_NAME] [FILE_NAME]

OPERATION: Only one operation argument is allowed and required. The most frequently used operations are:

  • create (-c) – Create a new tar archive.
  • extract (-x) – Extract the entire archive or one or more files from an archive.
  • list (-t) – Display a list of the files included in the archive.

OPTIONS: The most frequently used operations are:

  • verbose (-v) – Show the files being processed by the tar command.
  • archive-name( -f ) – Specifies the archive file name.

ARCHIVE_NAME: The name of the archive.

FILE_NAME: A space-separated list of filenames to be extracted from the archive. If not provided, the entire archive is extracted.

  1. Listing Tar Archives: When used with – – List (-t ) it lists the content of a tar archive without extracting it. To get more information we can use – – verbose (-v) .

$tar -tf archive.tar

2. Extracting Tar Archive: To extract a tar archive use the --extract (-x) option followed by the archive name:

$tar -xf archive.tar

if you want to print the names of the files being extracted add – -verbose ( – v).

$tar -xvf archive.tar

3. Extracting Tar Archive in a Different Directory:Want to extract file in specific directory use – -directory (- c)

$tar -xf archive.tar -C /home/files

4.Extracting Tar Gz and Tar Bz2 Archives: The command is same as tar archive.

$tar -xf archive.tar.gz

$tar -xf archive.tar.bz

5. Removing Files from a Tar Archive: We can use — delete (- f) operation to remove files from an archive.

$tar -f archive.tar file1

Leave your thought here

Your email address will not be published. Required fields are marked *