Introduction To Unix Linux
Introduction To Unix Linux
Company Overview
Mission
Mission
Adopt
Adopt best
best practices
practices and
and share
share with
with
others.
others.
2/224
Services
Software Development
Training
Advisory Services
3/224
Clients in 11 Countries
4/224
Agenda
Overview
Overview
General
General utility
utility commands
commands
Files
Files and
and directories
directories
Handling
Handling ordinary
ordinary files
files and
and filters
filters
File
File attributes
attributes and
and permissions
permissions
User
User and
and Group
Group management
management
Text Editor: Vi/Vim
Bash
Bash Scripting
Scripting
Package Management
Managing Processes
Basic Networking
UNIX History
Overview
6/224
UNIX Adoption
Overview
7/224
UNIX Characteristics
Overview
· Multitasking
· Multiuser
· Modular
· Scriptable
- UNIX programs
are meant to
work with one
another through
scripts
· Portable
- UNIX is the first portable operating system
8/224
The UNIX Philosophy
Overview
9/224
10/224
Linux
Overview
11/224
13/224
14/224
Commands to navigate your way
· pwd
- (your) present working directory
· ls
- list directory (like the MS-DOS DIR)
· cd
- change directory
15/224
This should say that you are currently in your "home directory".
16/224
List Directory Contents - ls
Contents of present working directory (by default, in alphabetical order):
$ ls
17/224
18/224
List Directory Contents - ls
List contents of a specified directory by including the directory path:
$ ls /
$ ls /usr
$ ls /usr/lib
$ ls -l /usr
19/224
$ ls -l --sort=size /var/log
$ ls -S /var/log
$ ls -lS /var/log
$ ls -lSrh /var/log
20/224
List Directory Contents - ls
Sorting
$ ls -tl /var/log
$ ls -tlr /var/log
21/224
$ ls -X /var/log
22/224
Change Directory - cd
Use cd to change your working directory:
$ cd D
ocuments
$ pwd
$ cd ..
$ pwd
$ cd /usr
$ pwd
$ cd
$ pwd
23/224
24/224
Paths
Absolute Path - Location of a file or directory starting from the root
directory. Starts with a /.
· /home/training/Documents
· /usr
· /usr/lib
25/224
Paths
Exercise:
Use ls to list the contents of the directories in the previous slides, using
absolute paths first, then using relative paths.
26/224
Paths
You can also represent the current working directory using '.':
$ ls .
$ ls ./D
ocuments
27/224
Wildcards
Partial string matches.
$ echo *
$ echo D*s
$ echo D*p
$ echo D
o*
$ echo D
o*
$ echo d
o* # Unix is case sensitive
$ echo *es
28/224
Wildcards
Partial string matches.
Application:
$ ls * # List contents of all directories in pwd
29/224
Wildcards
Partial string matches.
$ echo D*
$ echo D??????
$ echo D???????
$ echo *c
$ echo ????c
$ echo ?????c
30/224
Wildcards
Partial string matches.
$ echo *s
$ echo *[e]s
$ echo *[eo]s
$ echo *[eod]s
31/224
Wildcards
Partial string matches.
$ echo *[!e]s
$ echo *[!eo]s
$ echo *[!eod]s
32/224
Alias for Home Directory - ~
The ~ is an alias for the home directory of the logged-in user:
$ ls ~
$ cd ~/D
ocuments
$ pwd
$ cd ~
$ pwd
$ cd ~/..
$ pwd
33/224
If an error happens in any of the statements, the others will still execute.
$ cd ~/D
oc; pwd # ~/Doc does not exist
34/224
Tab Completion
Present the tab button can complete a partially typed-in command,
directory name or filename.
Try these partial commands and hit tab:
$ ls ~/D
oc
$ ls ~/D
esk
If there is more than one possibility, tab will present to you a list of
options. Hit the tab button after typing the partial command below:
$ pw
35/224
Command History
Press the up arrow key (↑). You will see the previous command you
typed.
Keep pressing to see the next older command. Use the down arrow key
(↓) to see newer commands.
Press enter to re-run the command, or you may edit the command first
before running it.
Use the history command to see a listing of previous commands:
$ history
36/224
User Manual - man
Use man to read the documentation of a command:
$ man pwd
To search, start with a '/', and then your search string. For example, to
search for the string "file":
/file
Press 'N' to move forward to the next result, and 'Shift-N' to move
backward to a previous result.
37/224
38/224
Clearing the Screen - clear
$ clear
39/224
Files
"Everything is a File"
Unix handles all input/output resources the same way as files.
· Directories are files describing other files.
· A keyboard is a file being read by the OS.
· A monitor is a file being written by the OS.
· A network card is a file being written and read by the OS.
This allows a consistent set of tools and techniques for handling a wide
set of resources.
41/224
42/224
Case Sensitive
Some operating systems are case insensitive, so "[Link]", "[Link]" or
"[Link]" will all refer to the same file.
Unix is case sensitive, so for example you try to open "[Link]" but
instead you type in "[Link]", you will get the error:
[Link]: ERROR: cannot open '[Link]' (No such file or
directory)
43/224
Spaces in Names
File & directory names can have spaces, but you'll need to handle them
differently. For example, if you have a directory called "Wedding
Pictures" you can:
Enclose in quotes:
· "Wedding Pictures"
· 'Wedding Pictures'
44/224
Hidden Files & Directories
Run ls in your home directory, then run it again with the "all" option -
ls -a. Notice that with the "all" option, you see more files and
directories, this time files and directories that start with a period (.).
Any file with a period prefix is automatically hidden from directory
listings.
Sensitive files and directories are usually hidden to prevent accidental
modification or deletion. Ex: configuration files, shared libraries, etc.
45/224
$ file .profile
$ file /bin/ls
47/224
$ stat .profile
$ stat /bin/ls
48/224
Detailed File Information - stat
If you just want specific info, add the -c option and supply a valid
parameter (see man page):
Access rights: $ stat -c %A .profile
49/224
50/224
Copy - cp
To copy an entire directory, use the -r option:
$ cp -r /var/log .
51/224
Copy - cp
Copy [Link] to your current directory:
$ cp /var/log/[Link] .
$ ls
52/224
Create Directory - mkdir
$ mkdir NewDirectory
$ ls
53/224
Move or Rename - mv
Moving and renaming files & directories use the same command - mv.
$ mv [Link] NewDirectory
$ ls # look for [Link]
$ ls NewDirectory
$ mv NewDirectory/[Link] NewDirectory/[Link]
$ ls NewDirectory
$ mv NewDirectory LogDir
$ ls
$ ls New Directory
$ ls LogDir
54/224
Deleting - rm
Deleting a file:
$ rm NewFile
$ stat NewFile
$ ls
Deleting directories:
$ rm LogDir
55/224
Deleting - rm
Correctly deleting directories:
$ rm -r LogDir
$ stat LogDir
$ ls
Note that if there are no errors in your statement, rm will delete your
files and directories without prompting. Be sure you are deleting the right
files and directories.
56/224
Links to Files & Directories - ln
Linking allows you to have more than one
path to a file or directory.
Sample Applications:
· Creating shortcuts.
· Organizing files in more than one
directory.
· Serving files in an application server
(e.g. web server) while at the same time
maintaining them in the user's within
the user's home directory.
· Access of a file between otherwise
incompatible filesystems.
57/224
58/224
Links to Files & Directories - ln -s
59/224
2. Hard links consume the same file size that of source file, soft links are
way smaller
3. Soft links are more visible/obvious that it is a symlink
60/224
Reading Text Files
· cat
- Output contents to console.
· less
- Scroll through file.
· head
- Output first lines to console.
· tail
- Output last lines to console.
61/224
$ cat .profile
$ cat
the quick brown fox jumped over the lazy dog
62/224
Reading Text Files
less:
$ less [Link]
63/224
tail:
64/224
Word Count - wc
$ wc [Link]
65/224
66/224
Check Differences - diff
Returns differences in content (not metadata).
$ diff /var/log/[Link] [Link]
67/224
Standard I/O
With the notion that "everything is a file" in Unix, Command Outputs
are also files
Types of outputs
1. standard input (stdin); your keyboard inputs
2. standard output (stdout)
3. standard error (stderr)
68/224
Redirect stdout
To redirect Standard Outputs
$ ls -l /usr/bin > [Link]
69/224
Redirect stderr
To redirect Standard Error
$ ls -l /bin/usr 2> [Link]
70/224
Redirect stdin
$ cat > lazy_dog.txt
the quick brown fox jumped over the lazy dog
71/224
Example
$ ls -l /usr/bin | less
72/224
Silence is Golden - /dev/null
When you want to discard, mute, or do nothing on the output
$ ls -l /usr/bin > /dev/null
$ ls -l /bin/usr 2> /dev/null
73/224
74/224
Searching for Files & Directories - find
What are each of the statements below searching for?
$ find -name [Link]
75/224
$ find D
ocuments -name [Link]
76/224
Searching for Files & Directories - find
What are each of the statements below searching for?
$ find -size +1k
77/224
78/224
Searching for Files & Directories - find
Find by time in minutes:
$ find -mmin -60 # files modified less than 1 hour ago
79/224
$ find -mmin +10 -mmin -180 # files modified more than 10 min but less than 3 hours
80/224
Searching for Files & Directories - find
Wildcards
What's the difference in the output of the two statements above? Why?
81/224
82/224
Searching for Files & Directories - find
Combining Multiple Criteria
AND will take precedence over OR, unless you use parenthesis:
$ find -iname "dpkg*" -o -name "*log" -type d
$ find \( -iname "dpkg*" -o -name "*log" \) -type d # note space before & after parentheses
83/224
84/224
Regular Expression Parser - grep
syntax:
grep [options] regex [file...]
ex:
$ ls /usr/bin | grep zip
Note: the "|" symbol is to "pipe" the output of a command to the next one
85/224
87/224
User Identity - id
id
$ id
uid=1000(armand) gid=1000(armand) groups=1000(armand),4(adm),24(cdrom),27(sudo)
· When user accounts are created, the user is assigned a user ID (uid)
which is mapped to a username
· The user is also assigned its own group ID (gid). This is different from
the uid.
88/224
User Identity files
· /etc/passwd
- defines the username, uid, gid
· /etc/group
- defines the groups and members for each
· /etc/shadow
- pseudo-copy of /etc/passwd but has other pertinent details
89/224
Substitute User - su
su - substitute user
$ su
Password:
#
90/224
Execute a command as another user (or root)
1. Execute as root using su -c
$ su -c 'ls -l /root'
91/224
$ sudo ls -l /root
92/224
Changing password - passwd
Syntax
passwd [user]
93/224
94/224
File Permission 101
Attribute File Type
- Regular File
d Directory
l Symbolic Link
95/224
96/224
File Permission by-the-numbers
97/224
98/224
Changing File Permissions
chmod - change file mod bits
Syntax
chmod [options] [mode] [file]
Examples
$ chmod 600 [Link] # change a file to read and write by user only
$ chmod +x [Link] # adds executable permission to all
$ chmod -R -w /home/user/some_folder/ # removes write permissions recursively in location
99/224
u user
g group
o others
100/224
Changing File User/Group Owners
chown - change user/group ownership of a file/directory
Syntax
chown [options] [owner]:[group] [file]
Example
$ chown armand:armand [Link] # changes a file to be owned
# by user "armand" and group "armand"
101/224
Syntax
$ chgrp [options] [group] [file]
Example
$ chgrp armand [Link] # changes a file to be owned by group "armand"
102/224
Setting Default Permissions - umask
umask - uses octal notation to represent a mask of bits
$ umask
0000
103/224
104/224
User and Group Management
106/224
Creating a User
useradd
107/224
Creating a User
adduser
108/224
Creating a Group
groupadd and addgroup
# addgroup [groupname]
109/224
Deleting a User/Group
deluser - deletes a user
# deluser [username]
# delgroup [groupname]
Notes:
· Be mindful of files dependent on the permissions of the user/group to
be deleted
· Some user/group are being used by the system or other applications
110/224
Modifying an existing User
usermod - change details for a user
Examples
# usermod -aG sudo user # adds user to the sudo group
# usermod -md /home/newuserhome user # changes the home directory location of user
Caution:
· not recommended to modify a user's password, the passwd
command is there for you
111/224
Day 1 Exercise
Day 1 Exercise
1. from the command lspci, find out the following
· anything about "Ethernet"
· anything about "VGA"
2. save whatever relevant output you got for each category in their own
respective file
· name the file for each output however you please
· save it in a "lspci-output" folder inside your home directory
113/224
115/224
Vi/Vim
Vi
· Written by Bill Joy in 1976.
· Vi is short for "visual".
Vim
· Written by Bram Moolenaar in 1991.
· "Vi Improved"
116/224
Vi/Vim
Launching & Quitting
Quit:
:q
117/224
Vi/Vim
Writing to Buffer
Press the 'i' key. This will start the "insert" mode, which allows you to
write to the Vi/Vim buffer (memory).
Write something:
Hello Vim!
118/224
Vi/Vim
Writing to Buffer
Try to quit:
:q
Force quit:
:q!
119/224
Vi/Vim
Save & Exit
120/224
Vi/Vim
Edit & Save
Launch a 2nd terminal so that we can check on the file while we edit it.
Launch Vim in one of the terminals:
$ vim NewFile
121/224
Vi/Vim
Edit & Save
Now go to the other terminal and check what happened to the file:
$ cat NewFile
122/224
Vi/Vim Exercise
Edit a file using Vi/Vim
· download the file by doing a wget [Link]
- rename the file (may look like 2ptwfJP) to [yournickname].txt
- provide your answers beside the respective field
- replace blank fields with respective answer by inserting it
- no using of gedit
123/224
BASH Scripting
Main Steps in Making Scripts
1. Write a Script
2. Make the Script Executable
3. Put the Script somewhere the shell can find it
125/224
Write a Script
Start by creating the file
$ vim hello_world
Note: Make sure you know which directory you are before doing this.
126/224
Write a Script
Sample Script file format
#!/bin/bash
# This is our first script
# The script should always start with
# #!/bin/bash or intended shell
echo 'Hello World'
127/224
Comments - #
Anything after a '#' is a comment. This is useful when scripting
commands together.
$ # This is a comment. It does nothing.
128/224
Make the Script Executable
$ ls -l
$ chmod +x hello_world
129/224
OR
$ /path/to/the/file/hello_world
130/224
Adding a little Data
#!/bin/bash
title='Hello'
echo $title World
echo $title Armand Shifu
131/224
132/224
Declaring variables
a=z # Assign the string " z " to variable a.
b='a string' # Embedded spaces must be within quotes.
c="a string and $b" # Other expansions such as variables can be
# expanded into the assignment.
d=$(ls -l [Link]) # Results of a command.
e=$((5 \* 7)) # Arithmetic expansion.
f='\t\ta string\n' # Escape sequences such as tabs and newlines.
133/224
Must be...
$ mv $filename ${filename}1
134/224
Taking Variables a notch higher
#!/bin/bash
TITLE="System Information Report for $HOSTNAME"
CURRENT_TIME=$(date +"%x %r %Z")
TIME_STAMP="Generated $CURRENT_TIME, by $USER"
135/224
Environment Variables
· Environment Variables are a set of dynamic named values that can
affect the way running processes will behave.
· To list all environment variables, use the env command
· They are typically located in the following config files:
- /etc/profile
- /etc/environment
- ~/.bash_profile
- ~/.profile
- ~/.bashrc
136/224
Environment Variables
Example
$ echo $PATH # PATH is an environment variable
/usr/local/bin:/usr/bin:/bin
137/224
Environment Variables
Define an Environment Variable in ~/.bashrc
$ vim .bashrc # edit the .bashrc file
138/224
Environment Variables
Test by reloading .bashrc or re-login the terminal session
$ echo $SCRIPT_HOME
$ source .bashrc
$ echo $SCRIPT_HOME
/home/user/bin
139/224
140/224
Functions
#!/bin/bash
# Portion for functions
my_name=$1
rap_song() {
echo 'Hi, my name is'
}
# Start of Script
rap_song
echo what
rap_song
echo who
rap_song
echo $my_name
141/224
Functions
#!/bin/bash
function rap_song() {
echo 'Hi, my name is'
}
142/224
Functions - Arguments
· $#
- number of arguments
· $*
- all arguments
· $@
- all arguments, starting from first
· $1, $2, ... $n
- first, second, and nth argument
#!/bin/bash
function rap_song() {
echo "Hi, my name is $1"
}
rap_song "what"
rap_song "who"
rap_song "$1" 143/224
Conditional Statements
Syntax
if *commands*; then
*commands*
\[elif *commands*; then
*commands*...\]
\[else
*commands*\]
fi
$ x=5
$ if [ $x = 5 ]; then echo "equals 5"; else echo "not equal to 5"; fi
144/224
Conditional Statements - String Comparison
· [ -z STRING ]
- checks if STRING is empty
· [ -n STRING ]
- checks if STRING is not empty
· [ STRING1 == STRING2 ]
- checks if STRING1 and STRING2 are equal
· [ STRING1 != STRING2 ]
- checks if STRING1 and STRING2 are not equal
145/224
146/224
Conditional Statements - Numeric
Comparison
· [ NUM1 -gt NUM2 ]
- checks if NUM1 is greater than NUM2
· [ NUM1 -ge NUM2 ]
- checks if NUM1 is greater than or equal to NUM2
147/224
148/224
Conditional Statements - File
· [ -e FILE ]
- checks if the FILE exists
· [ -f FILE ]
- checks if the FILE is a file
· [ -d FILE ]
- checks if the FILE is a directory
· [ -x FILE ]
- checks if the FILE is executable
149/224
150/224
Conditional Statements - Using Case
case "$1" in
hello)
echo 'You said hello'
;;
hi)
echo 'You said hi'
;;
esac
151/224
Loops - For
Syntax
for var in **EXPR**; do
echo $var
done
Example
for word in `cat /usr/share/dict/words`; do
echo $word
done
for i in {1..2}; do
echo $i
done
152/224
Loops - While
Syntax
while **EXPR**; do
echo "I'm alive!!!"
done
Example
while true; do
echo "I'm alive!!!"
done
153/224
154/224
Brace Expansion
· {A, B}1
- results to A1 B1
· {A..E}
- results to A B C D E
· {Z..U}
- results to Z Y X V U
· {:..?}
- results to : ; < = > ?
· {1..10..2}
- results to 1 3 5 7 9
155/224
Arrays
Declaration
myarray=('quick' 'brown' 'fox' 'jumps')
myarray[1]='quick'
myarray[2]='brown'
myarray[3]='fox'
myarray[4]='jumps'
156/224
Arrays - Operations
myarray=("the" "${myarray[@]}")
157/224
Arrays - Operations
myarray=("${myarray1[@]}" "${myarray2[@]}")
158/224
Arrays - Working with Arrays
${myarray[1]}
159/224
read input
echo $input
160/224
Exit Status
· a value of 0 indicates success
· a value of 1 or 2 indicates fail or error
· exit status can range from 0 to 255
Try the following commands
$ ls -d /usr/bin
$ echo $?
$ ls -d /bin/usr
$ echo $?
161/224
162/224
Miscellaneous - Subshells
$ pwd
/home/training
$ pwd
/home/training
163/224
Process Management
Processes 101
Boot process variants
1. init.d
· old/robust one
· runs init scripts that starts the system processes
· system processes to run is based on the runlevel
2. systemd
· "next generation"
· service level dependencies are defined to make boot process faster
· all services/process will start as control groups
165/224
166/224
Init runlevels
init Description
0 shutdown or halt
6 restart
167/224
168/224
Viewing Processes
· ps
- Report a snapshot of current processes
· top
- Display tasks
· jobs
- List active Jobs
169/224
$ ps
170/224
Viewing processes with ps
ps x (Note that there is no dash)
$ ps x
171/224
$ ps uax
172/224
Status codes for process
State Meaning
R Running
S Sleeping
T Stopped
Z Zombie Process
173/224
$ top
174/224
Viewing Dynamically with top
· To quit, press Q
175/224
$ jobs
176/224
Managing jobs
· Ctrl+C
- interrupts or exits a process
· Ctrl+Z
- stop or pauses a process
· bg or &
- Places a job in the background
· fg
- Places a Job in the foreground
177/224
Interrupting a program
Do a Ctrl+C
Example
$ xlogo # then do a Ctrl+C
$
· it interrupts a program
· asks the program to terminate on the spot
· many (but not all) command-line programs can be interrupted by
using this technique
178/224
Stopping (or pausing) a program
Do a Ctrl+Z
Example
$ xlogo # then do a Ctrl+Z
[1] Stopped xlogo
$
179/224
$ xlogo &
[1] #####
$
180/224
Putting a Process in the Background
· A process in the background is immune from keyboard input
· A process/job in the background will only exist while the current
terminal session is alive
· A background process/job will still output to the active terminal unless
redirected elsewhere before putting in the background
181/224
$ jobs
[1]+ Running xlogo &
$ fg %1
xlogo
182/224
Automating Jobs
· Users manage and create scheduled jobs or periodic execution of
scripts/commands via crontab
- Can create, edit, install and remove cron jobs
- Schedule to as accurate by the second
- Run commands/scripts by the system or by a specific user account
· A cron daemon/application is responsible for the execution of
scheduled scripts or commands
· The cron service periodically checks /etc/crontab and
/etc/cron.*/ for scheduled tasks/jobs
183/224
· first-time access of the user crontab will prompt the default text
editor to use
· will generate a crontab file for the active user session
184/224
Automating Jobs via crontab
crontab job schedule format
| | | | |
| | | | ----- Day of week (0 - 7) (Sunday=0 or 7)
| | | ------- Month (1 - 12)
| | --------- Day of month (1 - 31)
| ----------- Hour (0 - 23)
------------- Minute (0 - 59)
185/224
186/224
Handling cronjob outputs
MAILTO="armand@[Link]"
0 10 * * * /path/to/[Link] > /dev/null 2>&1
5 0 * * * /path/to/command | mail -s "command results" armand@[Link]
*/15 13-18/2 * * * /path/to/[Link] > /var/log/`date +%F`-[Link] 2>&1
187/224
Signals
· mechanism in communicating with programs/processes
· programs "listen" for signals and act upon receiving one
· the keyboard commands Ctrl+C and Ctrl+Z also sends signals
- Ctrl+C sends a INT (interrupt) signal
- Ctrl+Z sends a TSTP (terminal stop)
188/224
Common Signals
Number Name Meaning
1 HUP Hang-up
3 QUIT Quit
189/224
190/224
Other Process-Related commands
1. pstree
· Outputs a process list arranged in a tree pattern
· Useful to identify the parent-child relationship between processes
2. tload
· display a graph in the terminal of system load vs. time
3. vmstat
· Displays a snapshot of system resource usage
4. df
· Displays a report on file system storage usage
5. free
· Displays current physical and virtual memory usage
191/224
Package Management
About Package Systems
· Linux applications are distributed in a form of Package Files
- a compressed collection of files that compromise the software package
- may contain supporting apps for the target software
- created by Package Managers
· Package files are hosted in Repositories (or Mirrors)
- may be hosted by the software vendor or third-parties
- contains thousands of packages, typically grouped by distro and OS
architecture
- may contain various versions of a package/software
193/224
194/224
Package Tools
Distributions Low-level Tools High-level Tools
195/224
Dependencies
· Programs typically rely on other software/program in order to work
- Common functions such as i/o control and hardware routines
- Will need to install shared libraries to satisfy the dependencies of
programs to be installed
· Modern or the High-level Package management tools takes care of
including these dependencies when installing an application
- Makes a list of package dependencies of intended software
- Fetches the package software and package dependencies from the
Repository (online)
- Install all the packages into the OS
196/224
Configuring Target Package Repositories
in Debian
in RedHat (Fedora)
· the configuration for the package repositories may vary per distro
· typically configured at /etc/[Link]
- or make an individual entry per mirror site at /etc/[Link].d/
197/224
# apt-get update
# apt-cache search [search string] # searches for a package matching the string
# apt-cache show [package name] # display details of identified package
in RedHat
# yum search [search string] # searches for a package matching the string
# yum info [package name] # display details of identified package
198/224
Installing a Package from the Repository
in Debian
in RedHat
199/224
in RedHat
200/224
Updating Packages from the Repository
in Debian
in RedHat
# yum update
201/224
in RedHat
202/224
List/Query about a (installed) Package
in Debian
in RedHat
203/224
in RedHat
204/224
Basic Networking
$ ping [Link]
traceroute
$ traceroute [Link]
mtr
$ mtr [Link]
206/224
Network Settings and Statistics - netstat
netstat
$ netstat
207/224
$ netstat -ie
208/224
Network Settings and Statistics - netstat
netstat -r
$ netstat -r
209/224
210/224
Network Configuration files
· Machine Hostname
- /etc/hosts - can be modified to override DNS routing table
- /etc/hostname - contains the value for hostname
211/224
for RedHat/Fedora
212/224
Network Management commands
· ifconfig
- similar to netstat -ie and MS-DOS ipconfig
· ip [options] [object]
- a replacement for ifconfig
· ifup [interface name]
- enables a given network interface
· ifdown [interface name]
- disables a given network interface
213/224
214/224
File Transfers Protocol
ftp - FTP terminal client
215/224
lcd changes the working directory on the local system; the default directory is from where the ftp
command was executed
get tells remote host to transfer the target file to the working local directory
bye Log-off from the remote host and ends the ftp session
216/224
Download files over the web
wget - non-interactive HTTP GET downloader
217/224
218/224
Secure Copy via SSH - scp
· Transfer a file to a remote host
$ scp /path/to/local/file user@[Link]:/destination/path/
219/224
Day 2 Exercise
Day 2 Exercise
· install the apache2 application
- once it finished the installation, test it by using a browser and access
[Link]
221/224
Day 2 Exercise
· make some minor changes in [Link]
- ServerAdmin email
- the DocumentRoot; should match the new soft-link you made in no.2
- the filename output for ErrorLog and CustomLog
· replace the [Link] in /etc/apache2/sites-enabled
- make a new soft-link of the [Link] inside the sites-
enabled folder
222/224
State of the UNIX address
<Thank You!>
training-sales@[Link]