Tutorial of Unix/Linux: Cédric Notredame (Adapted From NOMURA)
Tutorial of Unix/Linux: Cédric Notredame (Adapted From NOMURA)
Cdric Notredame
(Adapted from NOMURA)
Outline
1.
2.
3.
4.
5.
6.
7.
8.
9.
User
input
Shell
Kernel
structure).
User can put and remove any directories on the tree.
Top directory is /, which is called slash or root.
Users have the own directory. (home directory)
/etc
/sbin
/tmp
Temporary files.
Basic Commands
How to run commands
[someone]$
One command consists of three parts, i.e. command name,
options, arguments.
Example)
[someone~]$ command-name optionA optionB argument1 argument2
Basic Commands
How to run commands
Between command name, options and arguments, space is
necessary.
Opitions always start with -
Example:
cd ..
ls l .bashrc
mv fileA fileB
Basic Commands
Commands
ls
cd
cp
mv
rm
pwd
mkdir
rmdir
less, more, cat
man
Basic Commands
Commands
su
passwd
useradd
userdel
mount
umount
df
shutdown
switch user
change password
create new user account
delete user account
mount file system
unmount file system
show disk space usage
reboot or turn off machine
Basic Commands
1. Type following command in
your directory.
ls
ls a
ls la
ls -Fa
2. Make a directory
df
df -h
mkdir linux
pwd
cd linux
pwd
cd
pwd
rmdir linux
absolute path.
In relative path expression, the path is not defined
uniquely, depends on your current path.
In absolute path expression, the path is defined
uniquely, does not depend on your current path.
Absolute Path
Address from the root
/home/linux/
~/linux
~: ~: Alt+N
Similar to:
Relative Path
Relative to your current location
pwd
cd .
pwd
cd ..
pwd
cd ..
pwd
cd
Ablsoute Path
cd
mkdir mydir
pwd
cd /Users/invite
pwd
cd /Users
pwd
cd /
pwd
cd /Users/invite
cd ~/mydir
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)
tail
other lines.
Use pipe.
less redirect.txt
grep Desk redirect.txt
grep n Desk redirect.txt
man grep
tail redirect.txt | grep Desk
rm sample.txt
rm redirect.txt
Sorting
Commands
sort
-n
-k3
-rnk3
Permission
All of files and directories have owner and permission.
There are three types of permission, readable, writeable and
executable.
Permissions are given to three kinds of group. owner, group
member and others.
Example:
ls -l .bash_profile
-rw-r--r--
1 cnotred
cnotred
Permission
Command
chmod
chown
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
u: user (owner),
g: group,
o: others
a: all
Permission
Check permission
ls l .bash_profile
cp .bash_profile sample.txt
ls l sample.txt
Process Management
Process is a unit of running program.
Each process has some information, like process ID, owner,
priority, etc.
Process Management
Commands
kill
killall
ps
top
Process Management
Check your process.
ps
ps u
Check process of all
users.
top (To quit top, press
q)
ps e
ps ef
Install Software
Install Software
Commands
gzip
gunzip
tar
configure
make
compress a file
uncompress a file
archive or expand files
create Makefile
compile & install software
Install Software
Example: parallel programming library installation
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
Text Editor
Commands
Text Editor
Create the file Hello
pico hello.pl
Write hello.pl as follows.
#!/usr/bin/perl
print Hello World\n;
Make il executable
./hello.pl
Ctrl-C
Ctrl-Z
stop program
let program background
command.
[nomura@ssc-1]$ fg
Server
rshd
telnetd & ftpd
sshd
FTP client
HTTP client
POP, SMTP client
Tutorial of Unix/Linux
END