Download An Introduction to Linux
Transcript
Working with Files First, create a directory (i.e. folder) for today’s session, move to it, and verify where you are: cd ~ Change directory to your home directory mkdir unixintro Make directory ‘unixintro’ cd unixintro Change directory to ‘unixintro’ Now copy some files to it and get a directory listing. Be careful with your typing, and don’t ignore error messages! cp /usr/share/unixintro/* . ls Copy all the files in a directory to the current working directory. Asterisk (*) means ‘all files’. Dot (.) means ‘current working directory’. IMPORTANT: There is a space between the Asterisk (*) and the Dot(.) List all files in the current working directory The command ‘ls ’ simply lists the contents of the directory you are in. Now to learn how to rename files and delete them. cp phonebook junk Copy file (or folder) phonebook to junk mv junk junk2 Move a file (in this instance, we’re moving the file ‘junk’ to ‘junk2’, effectively renaming it. ls List all files in the current working directory rm junk2 Remove the file (or folder) junk2 ls List all files in the current working directory | 19