Linux Midterm  Review 1
21 Questions
7 Views

Choose a study mode

Play Quiz
Study Flashcards
Spaced Repetition
Chat to lesson

Podcast

Play an AI-generated podcast conversation about this lesson

Questions and Answers

What should you set to prevent disconnections when using the Windows version of PuTTY?

  • Your ACSIS password as your password
  • The seconds between keepalives to 55 (correct)
  • Your student number as your password
  • Your Blackboard userid as your password
  • What Unix command line deletes a directory and everything inside it?

  • rm -all dir
  • rm -r dir (correct)
  • deltree -all dir
  • rmdir -all dir
  • Which CTRL key will interrupt the command 'sleep 60' and take you back to the command prompt?

  • ^I
  • ^C (correct)
  • ^U
  • ^R
  • If you type the command 'touch foo ; mkdir bar ; mv foo mt/bar', what is true about the directory mt?

    <p>It is still empty</p> Signup and view all the answers

    What happens after the command 'mv cow/dog cow/././cat'?

    <p>The directory cow now contains only a file named cat</p> Signup and view all the answers

    If my current directory is /usr, which of these pathnames is equivalent to the pathname /usr/x/y/z?

    <p>x/./y/z</p> Signup and view all the answers

    What is the function of the 'apropos' command in Unix?

    <p>To find a keyword in the man pages</p> Signup and view all the answers

    What is the function of the 'grep' command in Unix?

    <p>To search for a string in a file</p> Signup and view all the answers

    How many arguments and options are there to the command: ls -lid /p

    <p>Two command line arguments, one of which contains three bundled options.</p> Signup and view all the answers

    If I am in directory /home/me and mt is an empty sub-directory, what is true after this command line: touch foo ; mkdir bar ; mv foo bar/mt

    <p>The directory mt is still empty</p> Signup and view all the answers

    What is true after the command line touch ./mt/fil ; mv mt/./fil mt/../../me/./y is executed?

    <p>The directory mt is still empty</p> Signup and view all the answers

    Which of these is the correct CLS name to use when on-campus (or via VPN)?

    <p>cst8207-alg.idallen.ca</p> Signup and view all the answers

    Simplify this pathname: /home/me/../you/../../etc/../home/me/../you/../me/../..

    <p>/</p> Signup and view all the answers

    What command would you use to find the string tony in the file /etc/passwd?

    <p>grep tony /etc/passwd</p> Signup and view all the answers

    If my current directory is /lib, which of these pathnames is equivalent to the pathname /lib/x/y?

    <p>./x/y</p> Signup and view all the answers

    If my current directory is /etc, which of these pathnames is equivalent to the file name /etc/passwd?

    <p>passwd</p> Signup and view all the answers

    What would you see if you typed this command: cat /foo

    <p>The contents of the file foo located in the ROOT directory</p> Signup and view all the answers

    What happens after the command mv foo/me foo/bar is executed?

    <p>The command fails because the name me does not exist</p> Signup and view all the answers

    If /bin/bash is a file name, which pathname almost always leads to the same file?

    <p>./bin/../../bin/bash</p> Signup and view all the answers

    To change your own account password, use this exact command line:

    <p>$ passwd</p> Signup and view all the answers

    What happens when you try to change to the parent directory of ROOT, e.g. cd / ; cd..

    <p>the shell current directory is still ROOT; no change</p> Signup and view all the answers

    Study Notes

    Linux File System and Commands

    • The touch command creates an empty file.
    • The mv command moves or renames a file or directory.
    • The mkdir command creates a new directory.
    • The rm command deletes a file or directory.
    • The cp command copies a file or directory.
    • The grep command searches for a pattern in a file or files.
    • The find command searches for a file or files based on various criteria.
    • The passwd command changes a user's login password.

    Pathnames and Directories

    • A pathname is a sequence of directory names separated by slashes.
    • The . refers to the current working directory.
    • The .. refers to the parent directory.
    • The ~ refers to the user's home directory.
    • The / at the beginning of a pathname refers to the root directory.
    • A directory can be referred to by its absolute pathname or its relative pathname.

    Changing Directories

    • The cd command changes the current working directory.
    • The cd command with no arguments changes to the user's home directory.
    • The cd / command changes to the root directory.
    • The cd .. command changes to the parent directory.

    File System Hierarchy

    • The root directory is the top-most directory in the file system hierarchy.
    • The /home directory contains user home directories.
    • The /etc directory contains system configuration files.
    • The /bin directory contains executable files.
    • The /lib directory contains library files.

    Command Line Options

    • Square brackets [] in a command synopsis indicate optional arguments.
    • The apo command displays a list of utilities available for compiling programs.
    • The man command displays the manual for a command or function.

    Using PuTTY

    • To prevent disconnections when using PuTTY, set the seconds between keepalives to 55.
    • The sleep command pauses execution for a specified amount of time.
    • The ^C key interrupts a command and returns to the command prompt.

    Miscellaneous

    • The _synopsis section of a manual page describes the command syntax.
    • The CL command line interface is used to interact with the operating system.
    • The HOME directory is the user's home directory.

    Studying That Suits You

    Use AI to generate personalized quizzes and flashcards to suit your learning preferences.

    Quiz Team

    Description

    Test your knowledge of Linux file system and commands, including creating files and directories, moving and copying files, searching for patterns, and more.

    More Like This

    Master Essential Unix Commands
    6 questions
    CEST-CE Term_2 GNU/LINUX (Week 3)
    44 questions
    Linux Midterm Review 2
    30 questions

    Linux Midterm Review 2

    LuxuryAbundance avatar
    LuxuryAbundance
    Unix File Management Basics
    37 questions
    Use Quizgecko on...
    Browser
    Browser