linux file system and the shell yonglei tao. linux file system consists of one or more...

10
Linux File System and The Shell Yonglei Tao

Upload: edward-parsons

Post on 13-Jan-2016

216 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Linux File System and The Shell Yonglei Tao. Linux File System  Consists of one or more self-contained file management units  each is known as a filesystem

Linux File System and The Shell

Yonglei Tao

Page 2: Linux File System and The Shell Yonglei Tao. Linux File System  Consists of one or more self-contained file management units  each is known as a filesystem

Linux File System Consists of one or more self-contained file

management units each is known as a filesystem

A file is a collection of related information including anything from which data can be

taken or to which data can be sent

Page 3: Linux File System and The Shell Yonglei Tao. Linux File System  Consists of one or more self-contained file management units  each is known as a filesystem

Basic Commands file fname

ls dir ls –F ls –a

cd ~ cd ..

Variable PATH

mv f1 f2 … dir mv oldf newf

rm f1 f2 … rmdir d1 d2

mkdir name

cp f1 d1 cp f1 f2

Page 4: Linux File System and The Shell Yonglei Tao. Linux File System  Consists of one or more self-contained file management units  each is known as a filesystem

Access Permission User types: owner, group, and other Access rights: r, w, and x

ls –l chmod a+rw letter.txt chmod o-wx report.ps

umask umask 022

Page 5: Linux File System and The Shell Yonglei Tao. Linux File System  Consists of one or more self-contained file management units  each is known as a filesystem

Record Your Session script … exit

script mySession … exit

Page 6: Linux File System and The Shell Yonglei Tao. Linux File System  Consists of one or more self-contained file management units  each is known as a filesystem

Command Line Syntax gcc –o proj proj.c

ls ls –r ls –x ls –rx ls -xr ls –r -x

ls -- help

Page 7: Linux File System and The Shell Yonglei Tao. Linux File System  Consists of one or more self-contained file management units  each is known as a filesystem

Display Message echo “a message” echo –e “enter filename: \c”

echo $PATH

printf “My Shell is %s\n” $SHELL

Page 8: Linux File System and The Shell Yonglei Tao. Linux File System  Consists of one or more self-contained file management units  each is known as a filesystem

Standard Input/Output and Redirection cat filename cat file1 file2 file3 > largefile cat cat < largefile cat > newfile.txt

cat file1 file2 >> file3

date > whoson who >> whoson cat whoson

Page 9: Linux File System and The Shell Yonglei Tao. Linux File System  Consists of one or more self-contained file management units  each is known as a filesystem

Pipes and Filters who | sort

grep date date.c cat date.c | grep date grep date < date.c | wc -l > temp

who | sort | wc who | sort | tee who.out | wc -l

Page 10: Linux File System and The Shell Yonglei Tao. Linux File System  Consists of one or more self-contained file management units  each is known as a filesystem

Filename Expansion (Wildcards) ls proj?.c echo proj* ls *.txt echo [aeiou]* echo [x-z]* ls part[a-d][0-4]