Lecture 1 Introduction NIS
Lecture 1 Introduction NIS
Linux Kernel:
provide a technology to interact with computer hardware.
Linux Distribution:
kernel, needed components to make up the OS and enough
application to create full working environment.
Linux Server:
no clear definition, but normally a stable and reliable platform for
mission critical services.
Desktop:
User Desktop system with ease_to_use applications that takes
advantage of the computers full power.
19/06/17 Introduction - Linux Training 5/42
Difference between Linux & Windows
Kernel Types:
Mach kernel(BSD), GNU Hurd Kernel, Linux kernel
Kernel Functions:
Input & output control
Device control
Process management
File management, etc...
19/06/17 Introduction - Linux Training 7/42
Multi-user Environment
Normal Situation:
Multiprocessor --> multi-user + multitasking
Why?
A non-pre-emptive strategy can lead to a deadlock situation.
Process: started by a program
Thread: several can be started by a process
Multi-threading: several threads co-existing.
Kali Linux:
debian-based distro for forensics and penetration testing.
BackBox
Ubuntu-based distro for security assessment and pentration testing.
CAINE
Ubuntu-based GNU/Linux live distribution created as a project of digital
forensics
BlackArch/ArchAssault
Arch-based GNU/ Linux distribution for pentesters and security researchers
Pentoo:
Pentoo is a security-focused livecd based on Gentoo
FHS Characteristic
FHS is becoming a standard
FHS specify directory directly under /
Makes working on Unix and Linux easy
All directory specified need not be on one machine.
FHS is not concern about directory content
/ root
Where all file system begins
Must be mounted before booting!!
Examples :
.bashrc bash configuration file
.bash_history contains history of all commands typed in bash
shell.
Exercise: Start virtual terminal 1 Ctrl+Alt+F1 and login with username & password
1.) type ls
2.) type ls /etc (list the content of /etc)
Options:
Variant:
Options:
-a : change the access time only
-m : change modification time
-c : does not create file if file do not exist
Examples:
touch file1
touch file2, file3. files 4
touch /tmp/file4
for navigation use the direction keys
b : moves one tip mask
such through the file using
/ : search forward
? : search backwards
n for next
cp command:
cp is use to copy file(s) and directories
cp will normally overwrite existing file
Syntax:
cp fromfile tofile
Options:
-i : interactive copying
-r /R: use for recursive copying
-s : us to create a symbolic links
-p : preserve ownership
19/06/17 Introduction - Linux Training 32/42
Operations on Files 2
mv command:
mv is use to move file(s) and directories
mv will normally overwrite existing file
Syntax:
mv currentposition newposition
Options:
-i : interactive moving
-f : non interactive moving
19/06/17 Introduction - Linux Training 33/42
Directory operations
mkdir command:
is use to create a directory
-p : use to create parent directories as when needed.
Syntax:
mkdir new_directory_name
rm command:
is use to delete files and directories
with (-r) option you can delete recursively
rmdir is use to delete empty
19/06/17 Introduction - Linux Training 34/42
Link files
soft link
has own inode number
point to the inode of the original file
delete the original file link is lost
ln -s original_file softlink_file
hard link
uses the inode of the original file
delete the original file the link still works
any update affects the original file
ln original_file hlink_file_name
19/06/17 Introduction - Linux Training 35/42
Regular Expressions Basics
Used in many programs to express patterns in text
Very useful for searching for patterns
Two forms simple and extended
Use depends on the program
Extended:
Bracket expression: use to match any of the characters
within the bracket. e.g [abc] / b[aeiou]g
Range expression: use to list start and end of range eg.
a[2-4]z
find
which
type
whereis
find command:
searches one or more directories for files matching certain
criteria
Syntax
find path option(s)
Options:
-name file_name (*,?,[]) are applicable
-type file_type (f,d,s,l, etc..)
-user owner_name
-group group_name
-ctime [-/+] days
-exec command
19/06/17 Introduction - Linux Training 39/42
Finding files 3
Example
find /home -type f -name file_1
searches through /home and its sub-directories file_1
whereis command:
attempt to find (-s)source, (-m)manual page, (-b) binaries of specified
command
Syntax:
whereis [option(s)] command
Example:
whereis ls
whereis cat
whereis -b ifconfig
Exercise: (TRY)where can you find the binaries of route?
19/06/17 Introduction - Linux Training 41/42
Finding command file 2
which command:
specify the version which is run when command is type
search for command using PATH environment variable
Syntax:
which command
Example:
which ls
which cat
which ifconfig
19/06/17 Introduction - Linux Training 42/42
Finding command file 3
type command:
shows whether a command is shell built-in or from an external
source
Syntax:
type command
Example:
type ls
type cd
type type
type which
19/06/17 Introduction - Linux Training 43/42
Search file content
grep command:
use to search for a pattern in a file or list of files without
opening them.
pattern can be a keyword or a phrase.
Syntax:
grep [option(s)] pattern file_name
Options:
(-i) if you want to ignore state
(-v) print out lines that do not contain the pattern
(-n) show line numbers
(-L) file that do not contain the pattern
19/06/17 Introduction - Linux Training 44/42