Professional Documents
Culture Documents
Linux Shell
Linux Shell
Choopan Rattanapoka
Introduction
Terminal
Graphical Terminal
Remote Terminal (Telnet, SSH)
command line
Shell
Linux shell
BASH (Bourne-again shell)
Linux Shell
whoami
Linux
whoami
Login Linux
root
root Login
su
Directory
Directory
pwd
cd
mkdir
mv
ls
rm
rmdir
directory
directory
Directory
directory
directory
directory
Directory
directory Hello directory Test
home directory ()
directory
Linux directory ( folder)
Directory Linux
root
home
bin
sbin
lib
usr
home directory
directory home
Linux
library
usr/bin
usr/sbin
usr/lib
library
var
log, database, web, mail
boot
boot
etc
config
lost+found
media
dynamic (USB key,
CD-rom)
misc
NFS
srv
web, ftp, cvs
mnt
(CD-ROM, remote file)
opt
3rd-party
proc
dev
hardware (HDD, network card)
tmp
ls -l list
Directory
Linux 3
drwxrwxrw
x
all
group
user
directory
rwx
r = read
w = write
x=
execute
link directory
(File types)
-
d directory
l soft link
b block device (HDD, CD-ROM)
c character device (modem)
s socket network
p pipe
(1)
(user) u
(group) g
(all) a
(read) r
(write) w
(execute) x
myfile.txt
(2)
3 , ,
, ,
rwx
421
myfile.txt
chmod 740 myfile.txt
touch Linux
testpriv1
testpriv2
testpriv1
testpriv2
Text Editor : vi
Linux command
line text editor vi
vi
text
editor
vi Linux Unix
Linux
vi
vi 2
vi
vi
vi
vi
vi ESC
vi
Up arrow, k
cursor 1
Down arrow, j
cursor 1
Left arrow, h
cursor 1
Right arrow, l
cursor 1
:q
:q!
:w
:wq , ZZ
cursor
dw
1 cursor
dd
1 cursor
vi (2)
/ <text>
yy
undo
Copy cursor
yw
Copy cursor
Paste copy
cursor
cursor
<>G
<>
hello vi
Hello everybody
This is my text file created by vi
Try to copy the following line 5
times
HelloWorld
HelloWorld
HelloWorld
HelloWorld
HelloWorld
Try to save this file with :w
ello
XHelloWorldX
cat
cat 1 2
more
more
less
head
tail
head tail option -n
head
-n 10
10
tail
-n 10
10
link
Linux link 2
Soft link
Hard link
Link
text processing
Comman
d
Usage
Description
wc
wc < >
grep
cut
sort
wc
option
-l
-w
-c
grep
grep
grep
root /etc/passwd
root /etc/passwd
grep
regular expression (option r)
Regular expression
pattern
Regular expression
Pattern
Usage
[aeiou]
Matching 1 a, e, i, o, u
[a-z]
Matching a z
[a-z][A-Z]
Matching a z A Z
^<pattern>
Matching
pattern
<pattern>$
Matching pattern
^[a-z][0-9]$
.
Matching a z
<pattern>+
Matching pattern 1
<pattern>*
Matching pattern 0
<pattern>?
Matching pattern 0 1
Matching 1
grep -r
grep cit
Hello
Hello
World
World
HelloWorld
4
cut
cut option
-c
-f
-d (delimiter)
-c -f 5
N
N
N N
N-M
N M
-M
M
N,M,.. N, M,
cut
/etc/passwd
: root:x:0:0:root:/root:/bin/bash
username:password:userID:groupID:name:HomeDirecto
ry:shell
cut username
cut 3
sort
sort
sort [option]
/etc/passwd
sort
/etc/passwd
option -n
sort
-n
standard input
standard output standard error
Redirection
Redirection
Piping
Help Linux
ls
/etc/passwd Linux
username, home directory, shell
exo1
userID
exo2
username username s
exo3
username username er
exo4