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 A file is a collection of related information including anything from which data can be taken or to which data can be sent
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
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
Record Your Session script …… exit script mySession …… exit
Command Line Syntax gcc –o proj proj.c ls ls –r ls –x ls –rx ls -xr ls –r -x ls -- help
Display Message echo “a message” echo –e “enter filename: \c” echo $PATH printf “My Shell is %s\n” $SHELL
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
Pipes and Filters who | sort grep date date.c cat date.c | grep date grep date temp who | sort | wc who | sort | tee who.out | wc -l
Filename Expansion (Wildcards) ls proj?.c echo proj* ls *.txt echo [aeiou]* echo [x-z]* ls part[a-d][0-4]