Tutorial of Unix/Linux: Cédric Notredame (Adapted From NOMURA)
Tutorial of Unix/Linux: Cédric Notredame (Adapted From NOMURA)
Cédric Notredame
(Adapted from NOMURA)
Outline
1. Overview of Unix System
2. Basic Commands
3. Relative & Absolute Path
4. Redirect, Append and Pipe
5. Permission
6. Process Management
7. Install Software
8. Text Editor
9. Foreground and Background Jobs
Overview of Unix System
Kernel & Shell
Unix/Linux is operating system (OS).
Unix system is described as kernel & shell.
Case Sensitivity
Unix is case-sensitive.
MYFILE.doc, Myfile.doc, mYfiLe.Doc are different.
Online Manual
Unix has well-written online manuals.
Basic Commands
How to run commands
Finder => Application => Utilitaires => Terminal
When you log on Unix machine, you will see,
[someone]$
Example)
[someone~]$ command-name optionA optionB argument1 argument2
Basic Commands
How to run commands
Between command name, options and arguments, space is
necessary.
Example:
cd ..
ls –l .bashrc
mv fileA fileB
Basic Commands
Commands
ls show files in current position
cd change directory
cp copy file or directory
mv move file or directory
rm remove file or directory
pwd show current position
mkdir create directory
rmdir remove directory
less, more, cat display file contents
man display online manual
Basic Commands
Commands
su switch user
passwd change password
useradd create new user account
userdel delete user account
mount mount file system
umount unmount file system
df show disk space usage
shutdown reboot or turn off machine
Basic Commands
Similar to:
Lausanne University/Lausanne/Canton de Vaud/
Switzerland/Europe/Earth/Solar System/
Relative Path
Relative to your current location
. : your current location
.. : one directory above your current location
pwd: gives you your current location
Example
ls ./linux : lists the content of the dir linux
ls ../../ : lists everything that is two dir higer
Similar to:
Go Left/turn right/take the TSOL/go
Relative & Absolute Path
Ablsoute Path
Relative Path
cd
pwd mkdir mydir
pwd
cd . cd /Users/invite
pwd pwd
cd /Users
cd .. pwd
pwd cd /
pwd
cd .. cd /Users/invite
cd ~/mydir
pwd
cd
Redirect, Append and Pipe
Redirect and append
Output of command is displayed on screen.
Using “>”, you can redirect the output from screen to a file.
Using “>>” you can append the output to the bottom of the file.
Pipe
Some commands require input from a file or other commands.
Using “|”, you can use output from other command as input to the command.
On MacOSX, The Pipe sign: (Shift+Alt+N: franc, Alt+7)
Redirect, Append and Pipe
Commands
head show first several lines and omit other lines.
Example:
ls -l .bash_profile
-rw-r--r-- 1 cnotred cnotred 191 Jan 4 13:11 .bash_profile
Example)
chmod a+w filename
add writable permission to all users
chmod o-x filename
remove executable permission from others
chmod a+x
Gives permission to the usser to execute a file
gunzip software.tar.gz
tar –xvf software.tar
cd software
./install OR make all OR …
Text Editor
pico
Programs & configuration files are text file.
There are two popular text editors, vi and Emacs.
Although they are very powerful and useful, it is also true that they
are complicated for beginners and difficult to learn.
pico is an easy and simple alternative.
Text Editor
Commands
Arrow-keys Move cursor
CTRL+a Move to the beginning of the current line.
CTRL+e Move to the end of the current line.
CTRL+v Move forward one page.
CTRL+y Move backward one page.
CTRL+w Search for text.
CTRL+d Delete the current character.
CTRL+k Remove (cut) current line or selected text.
CTRL+u Paste (uncut) last cut text at the cursor position.
CTRL+o Save (output) the file.
CTRL+x Exit Pico, saving the file.
#!/usr/bin/perl
print “Hello World\n”;
Make il executable
chmod u+x hello.pl
Run it!
./hello.pl
Foreground and Background
Running job has two modes, “foreground” and “background”
Commands
Client Server
rsh & rcp
rshd
telnet & ftp
telnetd & ftpd
ssh & scp
sshd
Remote Login & File Transfer
END