A typical Phishing Analysis - University of North Carolina

Download Report

Transcript A typical Phishing Analysis - University of North Carolina

Linux Basic
TA for ITIS3100: Xu Fei
[email protected]
2008-01
Agenda
• Linux Basic
 What is Linux
 Linux Kernel
 Linux Family Map
 Linux distribution Example
 User Interfaces: GUI and CLI
• Linux Commands Basic
 Linux File System
 Directory Relationship
 File Permission
 Usage of ls; cat/less/more; cp; mv; rm; mkdir;
chmod; su; ps; kill; man
What is Linux?
• Linux is a Unix-like computer
operating system.
 free and open source
• Linux is now packaged for
different uses in Linux
distributions
Linus Torvalds,
creator of the
Linux kernel
Kernel
• In computer science,
the kernel is the
central component
of most computer
operating systems
(OS).
Family Map
Linux distribution Example
User interfaces
• Graphical user interfaces (GUI) accept
input via devices such as computer
keyboard and mouse and provide
articulated graphical output on the
computer monitor.
• Command line interfaces, where the
user provides the input by typing a
command string with the computer
keyboard and the system provides
output by printing text on the computer
monitor.
GUI in Linux
• Today, GNOME and KDE are the dominant
solutions, and often installed by default on
Linux systems.
Debian Screenshot
CLI in Linux
Agenda
• Linux Basic
 What is Linux
 Linux Kernel
 Linux Family Map
 Linux distribution Example
 User Interfaces: GUI and CLI
• Linux Commands Basic
 Linux File System
 Directory Relationship
 File Permission
 Usage of ls; cat/less/more; cp; mv; rm; mkdir;
chmod; su; ps; kill; man
Common Linux Command line
File and file
system
management
alias · cat · chattr · cd · chmod · chown · chgrp · cksum ·
cmp · cp · du · df · file · fsck · fuser · ln · ls · · lsof ·
mkdir · mount · mv · pwd · rm · rmdir · split · touch
Process
management
at · chroot · crontab · exit · kill · killall · nice · pgrep · pidof ·
pkill · ps · pstree · sleep · time · top · wait · watch
User
management/
environment
Text processing
Shell
programming
env · finger · id · logname · mesg · passwd · su · sudo ·
uname · uptime · w · wall · who · whoami · write
awk · comm · cut · ed · ex · fmt · head · iconv · join · less ·
more · paste · sed · sort · tac · tail · tr · uniq · wc · xargs
basename · echo · expr · false · printf · test · true · unset
Printing: lp · Communications: inetd · netstat · ping · rlogin · nc ·
traceroute · Searching: find · grep · strings ·
Miscellaneous: banner · bc · cal · dd · man · size · yes
Alphabetical Directory of Linux Commands
http://www.onlamp.com/linux/cmd/
You're not logged in as root, are you?
• Don't operate the computer as the root.
• You should only become the root when
absolutely necessary.
• Create a user account for yourself now!
File System Tree View
Directory Relationship
• Home Directory
• Root Directory
• Parent Directory
• Working Directory (Current Directory)
File Permission
Explanation
• r = read
• w = write
• x = execute
• u = the owner user
• g = the owner group
• o = others (neither u, nor g)
• chmod to change permission
File types
File Type
Description
ASCII text
The name says it all
Bourne-Again shell
A bash script
script text
ELF 32-bit LSB core file A core dump file (a program
will create this when it
crashes)
ELF 32-bit LSB
An executable binary
executable
program
ELF 32-bit LSB shared A shared library
object
GNU tar archive
A tape archive file. A
common way of storing
groups of files.
gzip compressed data An archive compressed with
gzip
HTML document text
A web page
JPEG image data
A compressed JPEG image
PostScript document
A PostScript file
text
Viewable as text?
yes
yes
no
no
no
no, use tar tvf to
view listing.
no
yes
no
yes
ls
Command
Result
ls
List the files in the working directory
ls /bin
List the files in the /bin directory (or any other
directory you care to specify)
ls -l
List the files in the working directory in long format
ls -l /etc /bin
List the files in the /bin directory and the /etc
directory in long format
ls -la ..
List all files (even ones with names beginning with a
period character, which are normally hidden) in the
parent of the working directory in long format
cat / less / more
• user@debian:~$ cat testfile
• user@debian:~$ less testfile
• user@debian:~$ more testfile
• What is the difference?
cp
Command
cp file1 file2
cp i file1 file2
cp file1 dir1
cp R dir1 dir2
Results
Copies the contents of file1 into file2. If file2 does
not exist, it is created; otherwise, file2 is overwritten
with the contents of file1.
Like above however, since the "-i" (interactive)
option is specified, if file2 exists, the user is
prompted before it is overwritten with the contents
of file1.
Copy the contents of file1 (into a file named file1)
inside of directory dir1.
Copy the contents of the directory dir1. If directory
dir2 does not exist, it is created. Otherwise, it
creates a directory named dir1 within directory dir2.
mv
Command
mv file1 file2
Results
If file2 does not exist, then file1 is renamed
file2. If file2 exists, its contents are replaced
with the contents of file1.
Like above however, since the "-i"
(interactive) option is specified, if file2
mv -i file1 file2
exists, the user is prompted before it is
overwritten with the contents of file1.
The files file1, file2, file3 are moved to
mv file1 file2 file3 dir1 directory dir1. dir1 must exist or mv will exit
with an error.
If dir2 does not exist, then dir1 is renamed
mv dir1 dir2
dir2. If dir2 exists, the directory dir1 is
created within directory dir2.
rm
Command
rm file1 file2
rm -i file1 file2
rm -r dir1 dir2
Results
Delete file1 and file2.
Like above however, since
the "-i" (interactive) option is
specified, the user is
prompted before each file is
deleted.
Directories dir1 and dir2 are
deleted along with all of their
contents.
mkdir
• The mkdir command is used to create
directories.
• To use it, you simply type:
 user@debian:~$ mkdir directory
chmod
• Here's how it works:
 rwx rwx rwx = 111 111 111
 rw- rw- rw- = 110 110 110
 rwx --- --- = 111 000 000
• and so on...
 rwx
 rw r-x
 r--
=
=
=
=
111
110
101
100
in
in
in
in
binary
binary
binary
binary
=
=
=
=
7
6
5
4
• user@debian:~$ chmod 600 testfile
su (substitute user)
• user@debian:~$ su
• password:
• debian:/home/user# exit
• user@debian:~$ su • password:
• debian:~# exit
• debian:~# su user
• What is the difference between “su” and “su –”
ps
• ps displays the currently running
processes.
• Try:
user@debian:~$ ps -aux
kill
• kill is a command used to send simple
messages to processes running on the system.
By default, the message sent is the
"termination" signal, which requests that the
process exit.
• user@debian:~$ kill PID
• In computing, the process identifier (normally
referred to as the process ID or just PID) is a
number used by some operating system
kernels to uniquely identify a process.
• Use ps to get the PID
Man (Manual page)
• One of the easiest ways to find out how to use many
commands and some applications is through the man
command.
 user@debian:~$ man command-name
• If you are new to Linux, you might not find man pages as
useful as someone who is more accustomed to their
terse delivery of information. But man pages can provide
information on how to use commands on your system.
Even at this point, you can gain insight into your system
by familiarizing yourself with the man pages. You will
certainly want to know how to use them eventually.
• Try xman at the shell prompt, man pages in a graphical
presentation.
Screenshot for “man man”
Screenshot for “man ls”