Unix 001 - Session 1 - First Steps ================================== R. Dorion and J. Welsh, September 2019 Warm Up: -------- Intro: A computer uses a file system to organize the data the operator has directed it to store. If you've never used the command line, you've likely interacted with the file system with a mouse, the menus the mouse presents and have had the file folders presented as pictures of folders and files presented as pictures of the logos for the program the operating system plans to open the file with. Action: Complete the sentences by writing each prompt's number in the box for the corresponding completion below. 1. To see a list of the contents of a file folder/directory, I open the file browser with the mouse and ... 2. To move a file from one file folder/directory to another, I ... 3. To copy a file from one folder/directoy to another I ... 4. To see where I am in the file system I ... 5. To remove a file and/or directory/folder I ... 6. To move up the directory tree on the file system, e.g. into the parent folder of my current folder, I ... 7. To make a new file folder/directory I ... Answers: [ ] right click the mouse and click "New Folder". [ ] right click with mouse and click "Cut", click to navigate to the destination and right click with mouse and click "Paste". [ ] look at the window browser's file system path. [ ] double click the folder picture. [ ] click the up arrow in the corner of the file browser window. [ ] click through the file directory folders the file is located in, right click the file and click delete. [ ] click the file, press Control+c, click to navigate to the destination and press Control+v. Presentation: ------------- In a command line interface (CLI), there is no mouse and no pictures, just text. Thus, commands/words are issued by the operator to execute actions. Commands are issued from the command prompt using a common syntax, e.g. [SPACE][SPACE][ENTER] The options and parameters of a command tell the command how to operate, e.g. ls --help The --help option directs the `ls` command to display basic help. Bootup & Console Login - Check for "login:" prompt - Type: - Check for "password:" prompt - Type: ENTER - Password entry does not "echo" (display on screen) Normal & Forced Shutdown - Root (privileged) user - Command: poweroff - Holding power button Concepts: - Terminal (TTY) - "Printing" - "Reading" - Filesystem - Files - Directories - Shell - Working directory - Paths - Path separator: / (pronounced "slash") - / by itself means the root (top level) of filesystem - Not to be confused with root user! - Paths beginning with / are absolute (start from the root) - All other paths are relative (start from the working directory) First Commands: ls list the files in a directory ls -a list all the files, including hidden files, in a directory ls -l long list the files in a directory pwd Print the Working Directory cd Change Directory mkdir MaKe DIRectory rmdir ReMove an empty DIRectory rm ReMove a file cp CoPy a file from the source to the destination mv MoVe a file from the source to the destination man open the MANual page for a program. touch change file timestamps, create the file if it doesn't exist Cueing: ------- The _________ character is used as the seperator between commands and arguments. The ____ command copies a file from one location to another. To move a file from one location to another, the ______ command is issued. To open the manual page for a command/program, the _____ command is issued followed by the name of the command/program. The ____ command lists files in the current directory. To make a new directory, the _______ command is issued. To remove a file, issue the ______ command. The _____ command allows the operator to change directories. The _____ command allows the operator to remove an empty directory. To print the working directory, issue the ________ command. Practice 1 ---------- For each item, follow the direction then write the command you issued in the space provided. 1. List all files (including hidden) in your current working directory. 2. Make a new directory named "practice". 3. Create a new empty file in the practice directory named "test". 4. Make a new directory named moar-practice. 5. Copy the file practice/test to the moar-practice directory. 6. Move the moar-practice directory into the practice directory. STOP: Let the instructor check your work and proceed after. Practice 2 ---------- 1. Change your working directory to the moar-practice directory and write the command you issued below: 2. Print your working directory and write the result below: 3. Remove the test file from the moar-practice directory and write the command you issued below: 4. Issue the `cd ..` command (without the `) and print your working directory. Describe what happened: 5. Remove the moar-practice directory and write the command you issued below: 6. Change to your home directory and write the command you issued below: 7. Open the man page for the cp command and write below the short option for the copy in archive mode operation.