Discover millions of ebooks, audiobooks, and so much more with a free trial

Only $11.99/month after trial. Cancel anytime.

Profound Linux For Developers
Profound Linux For Developers
Profound Linux For Developers
Ebook252 pages2 hours

Profound Linux For Developers

Rating: 0 out of 5 stars

()

Read preview

About this ebook

This book contains topics about Linux for developers as well as advanced users or administrators. The shells & commands together with expansion & substitutionare explained in detail. Process communication with pipes & redirection are explained. Scripting is covered for both developers and system experts at both fundamental and advanced level. Topics such as files, array, strings, declarations are added. Initialization scripts & crontab are explained. MySQL/MariaDB, PostgreSQL, MongoDB databases; Apache, NGINX, Tomcat web servers; C/C++, Java, JavaScript, Python development kits are included.

Author

Önder Teker, the author of the book, develops projects since the end of the 1990s, gives courses and lectures since the beginning of the 2000s, and produces printed and electronic books and visual courses since the beginning of the 2010s.

LanguageEnglish
PublisherGodoro
Release dateNov 26, 2023
ISBN9786259947815
Profound Linux For Developers

Read more from Onder Teker

Related to Profound Linux For Developers

Related ebooks

Operating Systems For You

View More

Related articles

Reviews for Profound Linux For Developers

Rating: 0 out of 5 stars
0 ratings

0 ratings0 reviews

What did you think?

Tap to rate

Review must be at least 10 words

    Book preview

    Profound Linux For Developers - Onder Teker

    Profound

    Linux

    For

    Developers

    Önder Teker

    Godoro Publishing

    GODORO PUBLISHING

    Publisher Certificate No: 40946

    The Name Of The Book:

    Profound Linux For Developers

    Copyright © 2023 Godoro Publishing

    The Author Of The Book:

    Önder Teker

    First Edition, December 2023, Istanbul

    ISBN:

    978-625-99478-1-5

    Cover Design & Makeup:

    Önder Teker

    Printing & Binding:

    Godoro

    Special Printing Solutions

    Atikali Mah. Fatih Cad. No: 81 D: 2

    Fatih / İstanbul

    Telefon : (533) 561-2435

    http://www.godoro.com

    GODORO PUBLISHING

    Atikali Mah. Fatih Cad. No: 81 D: 2

    Fatih / Istanbul

    Phone : (533) 561-2435

    http://www.godoro.com

    Shell & Commands

    In this section, basics about the operating system commands and the shell which interprets commands are explained.

    Command

    General information about commands are provided here.

    Command & Interpreter

    In this section, what a command and interpreter means is explained.

    Command

    An instruction given as a few words is called a command. It is the thing a user requires the computer to do. In general, it is a word. For example, the expression below can be a command

    perform

    In many cases, it is shortened. For example, perform the important operation may be shortened as below:

    pio

    Argument

    The data given to a command is called an argument. For example, the expression below

    perform ABC

    means the perform command will be executed with the ABC argument.

    A command can take multiple arguments. Example

    perform ABC 123 xyz

    Or, no argument is needed. Example

    perform

    Option

    A command may run in more than one way. The extra requirement to a command is called an option. There may be multiple options. For example, the perform command can be run in a slow mode or a fast mode. Or a direct mode or an indirect mode. In that case, the call will be as below:

    perform -slow -indirect

    In some cases, an option is mandatory and in some others, it is optional. If it is mandatory and not given, an error message is printed.

    Parameter

    In some cases, an option needs a value. It is called a parameter. For instance, let us assume that the option speed. It needs the speed value. An example can be written as below:

    $ perform -speed 100

    This means the value given to the speed option is 100.

    A parameter can look like an argument. But a command will understand it as a parameter from its locations. For example, in the call below:

    $ perform -speed 100 200

    the first number is a parameter if the option takes one parameter. The second number is an argument for the command.

    In some cases, the parameter value is given after the option name. If it is a letter, the value is given just after it. Example:

    $ perform -s100 200

    If it is a word, an equals (=) sign can be used. Example:

    $ perform --speed=100 200

    Exit Code

    Each command or program returns an exit code as a result. If it is zero (0) it means the execution is a success. If any number other than zero is returned, it means the call is a failure.

    Interpreter

    The program which executes commands is called interpreter. Reading a command and trying to understand what it is and how to run it is called to interpret. The action is named interpretation. Each command has one file where instructions are kept. The interpreter finds that file, gives the arguments.

    Command Line

    A command is entered in a line and after pressing Enter key they are executed. The line in which commands are entered is called the command line. A command can be written in more than one line or more than one command can be executed in a single line. Sometimes all the calls of a command, the name, arguments and parameters are called a line since a command takes a line in general. The call of a command may be thought as a sentence which can take a line or more.

    Script

    Instead of running command one by one in a command line, they can be put into a file and executed from there. The extension of this file is something line sh (shell). This file is called a script. In a script file, some features of programming languages such as conditions or loops can be used. The task containing many commands and needs some logic are written to shell scripts and executed from there.

    Comment

    A script file or a file used for definitions may have some explanations. It is called a comment. It is given after hash (#) symbol. Example :

    # This is done becuase it is needed

    Sometimes, a command or a piece of executable statement can be turned into a comment. For example, the lines below:

    # echo Godoro

    # department = Publishing

    may look like a command but it does not work. Because, it is left as a comment. In order to activate it, the hash (#) symbol must be removed as below:

    echo Godoro

    department = Publishing

    Command Line

    The place where commands  for a shell are entered is called the command line. Here are some details about it.

    Command Prompt

    The expression after which commands are entered is called command prompt.  In general some words or expressions together with a symbol such as a dollar ($)  or hash (#) are used to show the command line. After that, a cursor may be blinking to show where the keys pressed in a keyboard will be displayed. For example, the command prompt looks like below:

    $ _

    Here the underscore represents the blinking cursor. Itshows the characters entered using the keyboard. It will move right each time a key is pressed. For example, if per is written, the command prompt will be as below:

    $ per_

    Multiple Commands

    In one line, multiple commands can be entered by the semicolon (;) symbol.  For example, the example below:

    $ mycommand ; yourcommand

    will execute the first command and then the second.

    There will be no relation between the two. It is the same as calling the method in two separate lines as below:

    $ mycommand

    $ yourcommand

    Clear

    The output printed on the terminal can be cleaned by the clear command. Its usage is as below:

    $ clear

    After this call, only the command line will stay and the other text will be cleared.

    Reset

    The reset command put the terminal to its initial state. It clears the output but also removes all the settings done by the user. Its usage is as below:

    $ reset

    This command can be used when the terminal is in a mess. Sometimes, a user may cause the terminal to behave as if it is broken. In those cases, calling the reset command will fix the problem.

    Command Prompt

    In this section, components of the command prompt and ways to customize them are explained.

    Admin

    If the user is an admin, a hash (#) symbol  can be used in some environments.

    # _

    Machine Name

    In some cases, the name of the machine or computer or host can be written before the $ symbol. Example:

    myachine $ _

    Username

    In some cases, a user name is added and the two pieces of information are written in square brackets ([]). Example:

    [ myuser@mymachine ] $ _

    Home

    If a user works in their home directory, the tilde (~) symbol is added as below:

    [ myuser@mymachine ~] $ _

    Working Directory

    The curent directory or working directory can be displayed in the command prompt. For example, the prompt may be as below:

    mymachine:/usr/bin$

    This shows that current directory is as below:

    /usr/bin

    Prompt String

    The command prompt can be changed by the PS1 (prompt string 1) variable. For example, the call below:

    PS1=Godoro>

    will change the prompt to this:

    Godoro> _

    There are some escape characters to customize the prompt. For example u means username, h means hostname, w means working directory. The call below:

    PS1="\u@\h - \w Godoro > "

    will make the prompt as below:

    myuser@myhost - ~/mydirectory Godoro > _

    Prompt Command

    There is another way to customize the command prompt. The PROMPT_COMMAND variable can be declared the command to produce the prompt is declared.  For example, the call below:

    PROMPT_COMMAND=date +'%y-%m-%d %H:%M >'

    will change the prompt to this:

    23-09-18 17:52 >

    Command Syntax

    The thing the user asked from the operating system is called command.

    Execute

    A command is executed by writing its name and pressing the Enter key. For example, if the name of the command is mycommand, it can be executed by writing its name as below:

    $ mycommand

    and pressing the Enter key.

    In most cases, programs or utilities which is called from a command line is also can be thougt as commands. For example, a program named myutility.exe can be called as below:

    myutility.exe

    In most case, the extension can be omitted as below:

    myutility

    Argument

    A command may take some extra information named arguments to perform a task. This is given after the command separated by a space ( ) symbol. For example, if 123 is to be given to the mycommand command, the call will be as below:

    mycommand 123

    More than one argument can be supplied. For example, the call below:

    mycommand 111 222 333

    takes 3 arguments.

    Argument, Option, Parameter

    If an argument is a value to the command, its called a parameter. If the argument is used to change the behavior of a command, it is called an option. The general syntax is as below:

    command -opt1 -opt2 -opt3 param1 param2

    Since a parameter does not have a name, their position is important. The second one must not be used instead of the first. On the other hand, the order of the options are not so important.

    In some cases, an option also can take some value by using equals (=) sign. Example:

    command -opt1=ABC -opt2=123

    Technically the name of a command or program is also called an argument at index 0.

    Option - Word

    A command may be called by some options. A command will be executed according to these options. If it is a word, an option is given after two dash (--). For example, an option named fast may be given as below:

    $ mycommand --fast

    Option - Letter

    In most cases, an option can be given by a single letter. Only one dash (-) is used. For example, instead of fast the f letter can be used as below:

    $ mycommand -f

    The case is important. The call below may refer to a different option from the one above:

    $ mycommand -F

    The letter may not be the inital of the word related to the option. Especially, if there are two options with the same initial, a different letter can be used. For instance, furious  may be represented by upper case F. The call below:

    $ mycommand -fast -furious

    can be written as  below:

    $ mycommand -f -F

    Multiple Options

    More than one option may be supplied to a command. For example, the call below:

    $ mycommand --fast --deep --careful

    have three options.

    The short forms can be used as below:

    $ mycommand -f -d -c

    The letters can be given after a single dash (-) sign as below:

    $ mycommand -fdc

    Advanced Syntax

    In this section some advanced features are explained.

    Range

    In some cases, a command can be called by an argument with multiple values. For this, the curly brackets ({}) can be used. The values can be given one by one with

    Enjoying the preview?
    Page 1 of 1