CIS 240 Introduction to UNIX Instructor: Sue Sampson
CIS240 – UNIX File Systems File Operations List View Copy Move Delete Change Ownership/Group Change Permissions
CIS240 – UNIX File Systems Viewing contents of text files cat [options] [filelist] Displays contents of file(s) Does not pause after each file Wildcards; *, ? can be used With no arguments, takes standard input and display to standout output One options is to include line numbers (-n)
CIS240 – UNIX File Systems Viewing contents of text files more [options] [filelist] Displays contents of file(s) one page at a time Wildcards; *, ? can be used For next page, hit space bar For next line, hit enter One options is to include number of lines ( –n25) head [options] [filelist] Displays line at the beginning of file tail [options] [filelist] Displays lines at the end of file
CIS240 – UNIX File Systems Files are added and changed by: The operating system Applications software (editors, word processors, spreadsheets, databases, etc) Transfer in from a network or external storage device (loading software packages or files transfer)
CIS240 – UNIX File Systems Files are deleted by: rm We can delete a single file or group of files with this command (wildcards) rmdir directory must be empty
CIS240 – UNIX File Systems Files are moved and copied by: mv mv myfiles/sample1.txt ~/sample1.old cp cp myfiles/sample1.txt temp/sample1.txt and are relative or absolute path names Relative starts with the current directory (no /) Absolute starts with the root directory (/)
CIS240 – UNIX File Systems Moving a group of files: mv * /temp mv /home/jrussell/*.txt /home/student01
CIS240 – UNIX File Systems Appending to text files: cat [filelist]>>destination file Appends contents of file list to destination file With no arguments, takes standard input and appends to destination file If destination file does not exist, it is created
CIS240 – UNIX File Systems Combining text files: cat [filelist]>destination file Concatenates contents of filelist (in order of appearance) and writes contents to destination file File overwritten if it already exists