A Basic Introduction to Linux
Ahmed Sultan
Cyber Security Consultant
@ahmedesultan
Agenda
• What is Linux ?
• Linux File Structure
• Basic Linux Commands
• File Permissions
What is Linux?
• Linux traces its roots back to UNIX, which
was developed by AT&T labs as an
operating system that was meant to
improve software development.
• However, because UNIX was owned by
AT&T, using UNIX meant having to pay
licensing fees and users were restricted by
the terms of the license.
• Linux was started by Linus Torvalds as a
project to create an environment that was
similar to UNIX, on which he could run on
his personal home computer.
[Link]
What is Linux?
• Linux is an Open-Source operating
system means the source
programming files, including the
kernel, shell, and applications are
available for downloading, viewing
and modification.
[Link]
What is Linux?
• There are many different versions or distributions of Linux.
A distribution is defined by its kernel, as well as its programs
and software packaging ([Link]
[Link]
What is Linux?
• Some Linux distributions are free, like CentOS and Fedora.
Others like RedHat Enterprise Server, cost money, but include
support services.
[Link]
The Value of Linux
• Linux is an operating system of choice in Security
Operations Center (SOC).
– Open source
• Allows analysts and administrators to tailor-build the OS.
– Command Line Interface (CLI) is very powerful
• Enables analysts to perform tasks directly or remotely on a
terminal.
– More user control over the OS
• Modify any aspect of the computer.
• Precise control over the functions of the computer.
– Better network communication control
• Great platform for creating network application.
[Link]
Linux in the SOC
• A custom security distribution of
Linux can be created for the SOC
with just the tools needed for the
job.
– Packet Capture (Wireshark)
– Malware Analysis Tools
– Intrusion Detection Systems
(IDSs)
– Firewalls
– Log Managers
– Security Information and Event
Management
(SIEM)
– Ticketing Systems
[Link]
The Linux Shell
User communicates with the OS by using the CLI or the GUI.
Terminal emulator applications provide user access to the CLI :
• terminator
• eterm
• xterm
• konsole
• gnome-terminal
[Link]
Working with Text Files
• There are many text editors available in Linux.
• Some text editors are for the CLI only, like vi, vim, and nano.
• Other text editors, like gedit, are GUI-based.
• CLI text editors allow system management remotely, such as via SSH.
[Link]
The Importance of Text Files in Linux
• In Linux, everything is treated as a file, this includes the memory,
the disks, the monitor, the files, and the directories.
• The operating system as well as most programs are configured by
editing the configuration files which are text files.
• Editing system or application configuration files requires super user
(root) privileges. This can be accomplished with the sudo
command.
[Link]
Linux File Structure
Linux File Structure
[Link]
Basic Linux Commands
What exactly is a “shell”?
• After logging in, Linux/Unix starts another program
called the shell
• The shell interprets commands the user types and
manages their execution
• The shell communicates with the internal part of the operating
system called the kernel
• The most popular shells are: tcsh, csh, korn, and bash
• The differences are most times subtle
• For this tutorial, we are using bash
• Shell commands are CASE SENSITIVE!
[Link]
Connecting to a Unix/Linux system
[Link]
Connecting to a Linux system
The “prompt”
The current directory (“path”)
The host
[Link]
Syntax Of Basic Commands
<command name> [<options>] [<arg1> <arg2> ... <arg n>]
Expressions between brackets [ ] are optional.
<options>: sequence of letters preceded by ‗-‘ character.
each letter represents one option.
the order of the options has no importance.
<arg i>: string of characters
its meaning depends on the current command
(usually, they are file pathnames)
<command name>: command name
usually an executable filename.
Different command elements are delimited by at least one space
character.
Linux/Unix is case-sensitive.
[Link]
To execute a command, type its name and arguments at the
command line
ls -l /etc
Command name Arguments
Options
(flags)
[Link]
Help!
• Whenever you need help with a command
type “man” and the command name
[Link]
Help!
[Link]
Help!
[Link]
Special Meanings
Some file names are special:
/ The root directory
. The current directory
.. The parent (previous) directory
~ My home directory
[Link]
Basic Commands
Command Function
mv Move or rename files and directories
chmod Modify file permissions
chown Change file ownership
pwd Display the name/path of the current directory
ps List the currently running processes
su Switch the current user to another user
sudo Run a command with the privileges of the super user
ifconfig View or configure the settings of the network interfaces
apt-get Install software using the advanced package tool
iwconfig View or configure the network wireless settings
shutdown Logoff and shutdown the operating system
passwd Change a user password
man Display the documentation for a specific command
[Link]
File and Directory Commands
Command Function
ls Display the files inside a directory
cd Changes the current directory
mkdir Creates a directory under the current directory
cp Copies files from source to destination
mv Moves files to a different directory
rm Removes files
grep Searches for specific strings of characters
cat Use to list the content of a text file
[Link]
File Permissions
File permissions
• Each file in Unix/Linux has an associated
permission level
• This allows the user to prevent others from
reading/writing/executing their files or
directories
• Use “ls -l filename” to find the permission
level of that file
[Link]
Permission levels
• “r” means “read only” permission
• “w” means “write” permission
• “x” means “execute” permission
[Link]
Linux Roles and File Permissions
In octal (3bits), per permission (i.e. 111 is a 7 for read, write and execute)
• User - the file owner’s permission
• Group - a group’s permission to a file
• Other – any user, non-owner’s permission to a file
• Read – the ability to look at a file’s contents
• Write – the ability to change a files contents
• Execute – the ability to run or launch a file (scripts and programs)
[Link]
File Permissions
User (you)
[Link]
File Permissions
Group
[Link]
File Permissions
“The World”
[Link]
Command: chmod
• If you own the file, you can change it’s permissions with “chmod”
– Syntax: chmod [user/group/others/all]+[permission] [file(s)]
– Below we grant execute permission to all:
[Link]
Thank you