“Linux Administration To Start As A Beginner”
“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
“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:
- 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.
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.
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.
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.
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
DESCRIPTION:mkdir command is used to create directory.
$mkdir [directories ]
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.
DESCRIPTION:Touch command is used to create, change or modify files in directories.
DESCRIPTION: locate command is used to check whether the locate utility is installed.
DESCRIPTION: Find command have multiple usage. The basic usage is to search for files and directories.
DESCRIPTION:Grep – print lines that match patterns.
$grep [option] patterns [files]
DESCRIPTION: The sudo command allows you to run programs with the security privileges of another user. It executes a file as sudoer.
DESCRIPTION: To display information related to file systems about total space and available space.
$df [option] [file]
DESCRIPTION: Allows a user to gain disk usage information quickly.
$du [OPTIONS] [FILE or DIRECTORY NAME]
DESCRIPTION: In its simplest form, when used without any option, the head command displays the first ten lines.
DESCRIPTION: chmod is used to change permission of the file or folder.
$chmod options permissions file name
DESCRIPTION: The chown command is used by system adminstrators to change the ownership of files and directories.
$chown [OPTION]. [OWNER] : [GROUP]] FILE.
DESCRIPTION: This command is used to end, or we say kill a process.
DESCRIPTION: top command is used to show the Linux processes.
$top -n 10
DESCRIPTION: history command is used to get list of all recent commands used in your system.
DESCRIPTION: A utility which is responsible for examining and controlling the system and service manager.
$Systemctl [service] [option]
DESCRIPTION: To retrieve the information and packages from the authenticated sources for installation, upgrade and removal of packages along with their dependencies.
DESCRIPTION: Displays ip and other configuration of your system.
25. Reboot command:
DESCRIPTION: Reboot command is used restart or reboot the system.
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 [OPERATION_AND_OPTIONS] [ARCHIVE_NAME] [FILE_NAME]
OPERATION: Only one operation argument is allowed and required. The most frequently used operations are:
-c) – Create a new tar archive.
-x) – Extract the entire archive or one or more files from an archive.
-t) – Display a list of the files included in the archive.
OPTIONS: The most frequently used operations are:
-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.
- 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
-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