Linux and Windows Operating system Fundamentals
Linux and Windows Operating system Fundamentals
, Ubuntu,
CentOS):
A "Linux distribution", often shortened to "distro", is an operating system
made from a group of software that includes the Linux kernel and, often, a
package management system. Linux users often download one of the linux
distributions, which are available for everything from powerful
supercomputers (like OpenWrt) to embedded devices (like Linux Mint) and
personal computers (like Ubuntu Desktop).
A Linux distribution is a set of tools and utilities, like different GNU tools
and libraries, that are packaged with the Linux kernel in a way that lets it
meet the needs of many different users.
Distributions come in a wide range of shapes and sizes because there is so
much software out there. There are distributions that can be used on desktops,
servers, laptops, netbooks, mobile phones, tablets, and in the minimal
environments that are usually found in embedded devices. There are
distributions like Fedora Linux (Red Hat), openSUSE (SUSE), and Ubuntu
(Canonical, Ltd.), which get money from companies, and distributions like
Debian, Slackware, and others, which only get money from the community.
Most distributions are already compiled and ready to use for a certain
instruction set. However, some, like Gentoo, are mostly distributed as source
code and must be compiled locally in order to be installed.
o A Linux distribution is an OS made through a software collection that
contains the Linux kernel and a package management system often.
o Usually, Linux users obtain their OS by downloading a Linux
distribution, available for a range of systems from embedded devices
(e.g., OpenWrt) to robust supercomputers (e.g., Rocks Cluster
Distribution).
o A Linux distribution is composed of a Linux kernel, GNU libraries and
tools, other software, a window system, documentation, a desktop
environment, and a window manager.
o Almost every added software is open-source and free and becomes
available both as in source code and compiled binary form, permitting
changes to the actual software.
o Optionally, Linux distributions add a few proprietary software that
might not be available in the source code form, like binary blocks
needed for a few device drivers.
o These are the top linux distributions;
o CentOS: Because its software is simple and light, CentOS runs faster
than other Linux distributions. The operating system has a longer
upgrade cycle, lasting approximately five years. (Other distributions
have shorter cycles.) Because of the more frequent updates, those other
distributions may be less reliable at times. As a result, CentOS is
regarded as a stable operating system.
o Kali Linux: Kali Linux is the best distribution for ethical hacking
objectives. Frankly, no other distribution can compete with Kali Linux.
The release includes a variety of tools that may be used for ethical
hacking. Device categories include wireless assaults, stress testing,
online applications, vulnerability analysis, and exploration instruments,
among others.
o Because Kali Linux is derived from the Debian Testing branch, the
majority of packages are imported from the Debian repository. In prior
versions, updates were not sent in an unreliable manner. In the most
recent version, however, it has worked with Offensive Security and
Cloudflare to ensure that all upgrades are successfully transmitted.
The pwd command is used to display the location of the current working
directory.
Syntax:
1. pwd
Output:
2. mkdir Command
The mkdir command is used to create a new directory under any directory.
Syntax:
Output:
3. rmdir Command
Syntax:
4. ls Command
Syntax:
Ls
Output:
5. cd Command
The cd command is used to change the current directory.
Syntax:
1. cd <directory name>
2. Output:
The touch command is used to create empty files. We can create multiple
empty files by executing it once.
Syntax:
3. Output:
7. cat Command
Syntax:
Press "CTRL+ D" keys to save the file. To display the content of the file,
execute it as follows:
Output:
8. rm Command
Syntax:
rm <file name>
Output:
9. cp Command
Syntax:
Output:
10. mv Command
Syntax:
Output:
Syntax:
For example, to convert all the text files into pdf files, execute the below
command:
Output:
The head command is used to display the content of a file. It displays the
first 10 lines of a file.
Syntax:
Output:
The tail command is similar to the head command. The difference between
both commands is that it displays the last ten lines of the file content. It is
useful for reading the error message.
Syntax:
Output:
14. tac Command
The tac command is the reverse of cat command, as its name specified. It
displays the file content in reverse order (from the last line).
Syntax:
Output:
Syntax:
1. su <user name>
Output:
16. id Command
The id command is used to display the user ID (UID) and group ID (GID).
Syntax:
1. id
Output:
Syntax:
1. useradd username
2. Output:
The passwd command is used to create and change the password for a user.
Syntax:
1. passwd <username>
Output:
19. groupadd Command
Syntax:
Output:
The cat command is also used as a filter. To filter a file, it is used inside
pipes.
Syntax:
Output:
Syntax:
Output:
The grep is the most powerful and used filter in a Linux system. The 'grep'
stands for "global regular expression print." It is useful for searching the
content from a file. Generally, it is used with the pipe.
Syntax:
Output:
Syntax:
Output:
The sed command is also known as stream editor. It is used to edit files
using a regular expression. It does not permanently edit files; instead, the
edited content remains only on display. It does not affect the actual file.
Syntax:
Output:
Syntax:
Output:
26. tr Command
The tr command is used to translate the file content like from lower case to
upper case.
Syntax:
Output:
The uniq command is used to form a sorted list in which every word will
occur only once.
Syntax:
Output:
28. wc Command
The wc command is used to count the lines, words, and characters in a file.
Syntax:
1. wc <file name>
Output:
29. od Command
Syntax:
Syntax:
Output:
The gzip command is used to truncate the file size. It is a compressing tool. It
replaces the original file by the compressed file having '.gz' extension.
Syntax:
Output:
32. gunzip Command
Syntax:
Output:
The find command is used to find a particular file within a directory. It also
supports various options to find a file such as byname, by type, by date, and
more.
Syntax:
1. find . -name "*.pdf"
Output:
The locate command is used to search a file by file name. It is quite similar to
find command; the difference is that it is a background process. It searches
the file in the database, whereas the find command searches in the file
system. It is faster than the find command. To find the file with the locates
command, keep your database updated.
Syntax:
Output:
Syntax:
1. date
Output:
The cal command is used to display the current month's calendar with the
current date highlighted.
Syntax:
1. cal<
Output:
The sleep command is used to hold the terminal by the specified amount of
time. By default, it takes time in seconds.
Syntax:
1. sleep <time>
Output:
38. time Command
Syntax:
1. time
Output:
Syntax:
Output:
40. df Command
The df command is used to display the disk space used in the file system. It
displays the output as in the number of used blocks, available blocks, and
the mounted directory.
Syntax:
1. df
Output:
The mount command is used to connect an external device file system to the
system's file system.
Syntax:
Output:
Syntax:
1. exit
Output:
Syntax:
1. clear
Output:
After pressing the ENTER key, it will clear the terminal screen.
Syntax:
1. ip a or ip addr
Output:
Linux ssh command is used to create a remote connection through the ssh
protocol.
Syntax:
1. ssh user_name@host(IP/Domain_name)</p>
The mail command is used to send emails from the command line.
Syntax:
Output:
Syntax:
1. ping <destination>
Output:
The host command is used to display the IP address for a given domain
name and vice versa. It performs the DNS lookups for the DNS Query.
Syntax:
Output:
o Primarily the computer saves data to the RAM storage; it may lose the
data if it gets turned off. However, there is non-volatile RAM (Flash
RAM and SSD) that is available to maintain the data after the power
interruption.
o Data storage is preferred on hard drives as compared to standard RAM
as RAM costs more than disk space. The hard disks costs are dropping
gradually comparatively the RAM.
Linux file system is generally a built-in layer of a Linux operating system used to
handle the data management of the storage. It helps to arrange the file on the disk
storage. It manages the file name, file size, creation date, and much more
information about a file.
The below table gives a very short standard, defined, and well-known top-
level Linux directory list and their purposes:
o Specifying paths: Linux does not use the backslash (\) to separate
the components; it uses forward slash (/) as an alternative. For
example, as in Windows, the data may be stored in C:\ My Documents\
Work, whereas, in Linux, it would be stored in /home/ My Document/
Work.
o Partition, Directories, and Drives: Linux does not use drive letters
to organize the drive as Windows does. In Linux, we cannot tell
whether we are addressing a partition, a network device, or an
"ordinary" directory and a Drive.
o Case Sensitivity: Linux file system is case sensitive. It distinguishes
between lowercase and uppercase file names. Such as, there is a
difference between test.txt and Test.txt in Linux. This rule is also
applied for directories and Linux commands.
o File Extensions: In Linux, a file may have the extension '.txt,' but it is
not necessary that a file should have a file extension. While working
with Shell, it creates some problems for the beginners to differentiate
between files and directories. If we use the graphical file manager, it
symbolizes the files and folders.
o Hidden files: Linux distinguishes between standard files and hidden
files, mostly the configuration files are hidden in Linux OS. Usually, we
don't need to access or read the hidden files. The hidden files in Linux
are represented by a dot (.) before the file name (e.g., .ignore). To
access the files, we need to change the view in the file manager or
need to use a specific command in the shell.
Configuration Files
Key Files for User and Group Management
Users
In Linux, a user is an individual who interacts with the system. Each
user has a unique username and a user ID (UID). User accounts are used
to log in, run processes, and access files and directories. Linux
systems typically have several user accounts, including
the root user, which has superuser privileges and can perform
administrative tasks.
Groups
Groups are collections of users. They are used to simplify access control
and permissions management. Users within the same group share
common permissions to files and directories. A group also has a unique
group ID (GID). When a user creates a file, the file’s group ownership
is set to the user’s primary group by default.
User Management
1. Creating Users
To create a new user, use the useradd command followed by the
username. For example, to create a user named "viswa," run:
Group Management
1. Creating Groups
You can create a group using the groupadd command:
4. Deleting Groups
To delete a group, use the groupdel command:
Examples
Conclusion
User and group management in Linux is vital for maintaining security
and access control. By understanding how to create, modify, and delete
users and groups, you can effectively manage permissions and organize
users in your Linux system.
Linux permissions allow you to set security levels for different users. Linux
allows you to define access levels for individual files, specify attributes, and
tighten security. This way you can provide granular permission levels and
improve file security.
Linux lets you choose from different file permissions for each type of user,
but they can generally include a combination of:
Read
Write
Execute
The Linux file system is a well-organized and fine-grained file system through
which you can securely store, organize, and retrieve files and directories through
its well-defined permission system.
Linux file permissions govern user access to files and folders. Permissions
control who can view, write, and execute files and directories, ensuring security.
Permissions are assigned to three categories of users: owner, group, and others
(sometimes called world).
Read (r): Grants permission to read the contents of a file or list the contents of a
directory.
Write (w): Grants permission to modify a file or create, delete, and rename files
within a directory.
Each permission category (owner, group, and others) has its own set of read,
write, and execute permissions. For example, a file’s permissions might be
represented as:
-rwxr-xr–
In this case, the first character indicates the file type (- for a regular file, d for a
directory). The remaining nine characters are divided into three groups, each
representing the permissions for the owner, group, and others, respectively. In
this example:
Owner (user) has read (r), write (w), and execute (x) permissions: rwx
Group has read (r) and execute (x) permissions, but not write permission: r-x
Linux file permissions can also be represented numerically using octal notation.
Each permission type is assigned a number:
Read (r) = 4
Write (w) = 2
Execute (x) = 1
The octal value of a permission set is the sum of its permission values. For
example, rwx (read, write, and execute) would be 4 + 2 + 1 = 7. The full set of
permissions for owner, group, and others can be represented as a three-digit
octal number, such as 755, which corresponds to -rwxr-xr-x.
chmod is a Linux command used to modify file and directory permissions. The
command allows you to modify the proprietor, group, and others’ read (r), write
(w), and execute (x) permissions. There are two primary ways to specify
permissions using chmod: symbolic mode and numeric (octal) mode.
Symbolic mode: In symbolic mode, you represent the user category and the
permissions you wish to modify with letters and symbols. The format of the
command is below:
For instance, to add execute permissions for the owner and group to
the script.sh file, you would execute: chmod u+x,g+x script.sh.
Octal mode: In octal mode, the permissions for each user category are
represented by octal numerals. The fundamental format of the command
is chmod [mode] file where mode is a three-digit octal number representing
permissions for the proprietor, group, and others, respectively.
For instance, to set file.txt’s permissions to -rw-r–r– (owner: read and write,
group: read, others: read), you would execute: chmod 644 file.txt.
In this instance, the octal number 644 represents the following permissions:
Linux file system is a powerful and flexible structure that supports the core
functionality of Linux-based systems. The root directory at the top and well-
defined subdirectories for specific reasons make file management and
navigation efficient. The Linux file permission system’s fine-grained access
control ensures safety and security.
Each file and directory in Linux has three types of permissions for three
categories of users:
Read (r): Allows reading the contents of the file or listing the contents
of the directory.
Write (w): Allows modifying the file or the contents of the directory.
Execute (x): Allows executing the file (if it is a script or a binary) or
accessing the directory.
Viewing Permissions
ls -l
Example output:
Changing Permissions
Symbolic Mode:
Numeric Mode:
Numeric values:
Read: 4
Write: 2
Execute: 1
File Ownership
ls -l
Example output:
Changing Ownership
Special Permissions
3. Sticky Bit:
o When applied to a directory, only the owner of a file can delete or
modify the file within that directory.
o Set with chmod +t directory_name.
o Represented by a t in the others' execute field (drwxrwxrwt).
Viewing ACLs
getfacl file_name
Setting ACLs
Example
Setting Permissions
1. Change file permissions to read, write, and execute for the owner;
read and execute for the group; and read-only for others:
When it comes to networking, Windows Server has become the standard. For
the last 16 years, Microsoft has released a major version of Windows Server
every four years and a minor version every two years. The minor versions
can be recognized with the suffix R2. The Windows operating system is
persistently updated to add new functionality to match the needs of today's
users. Administrators need to understand how their server has evolved and
upgraded. The list of all major and minor Microsoft Windows Server
versions is as follows:
Management Tools
Domain Controllers
sh
Copy code
Install-WindowsFeature -Name AD-Domain-Services -
IncludeManagementTools
4. Verify the Installation: Use tools like dcdiag to check the health and
functionality of the domain controller.
Conclusion
4. Credential Guard
o Isolated Environment: Uses virtualization-based security to
isolate and protect credential information.
o Prevents Credential Theft: Defends against pass-the-hash or
pass-the-ticket attacks by keeping credentials safe.
5. Secure Boot
o Ensures Boot Integrity: Protects the system from boot-level
malware by ensuring only trusted software loads during the boot
process.
Group Policies
2. Administrative Templates
o Predefined Settings: Offer a wide range of settings that
administrators can use to configure the operating system and
applications.
o Custom Templates: Allow the creation of custom templates to
manage application-specific settings.
3. Security Settings
o Account Policies: Includes password policies, account lockout
policies, and Kerberos policies.
o Local Policies: Encompasses audit policies, user rights
assignments, and security options.
o Event Log Policies: Manages settings for application, security,
and system event logs.
4. Software Installation
o Automated Deployment: Allows administrators to assign or
publish software to users or computers.
o Centralized Management: Helps in managing software
installation, updates, and removal across the network.
5. Scripts
o Startup and Shutdown Scripts: Executes scripts during
computer startup and shutdown.
o Logon and Logoff Scripts: Runs scripts during user logon and
logoff.
6. Folder Redirection
o User Data Management: Redirects user folders (e.g.,
Documents, Desktop) to network locations, ensuring data is
stored on servers rather than local machines.
4. PowerShell
o Automation: Automates Group Policy management tasks.
o Cmdlets: Includes cmdlets such as New-GPO, Get-GPO, Set-
GPLink, and Remove-GPO.
2. Regular Updates
o Patch Management: Keep servers and applications up to date
with the latest security patches and updates.
5. Testing GPOs
o Staging Environment: Test GPOs in a staging environment
before deploying them to production.
o RSoP: Utilize Resultant Set of Policy tools to simulate and verify
the impact of GPOs.
6. User Education
o Training: Educate users on security best practices and the
importance of adhering to policies.
Conclusion