CS253: Software Development with C++

Spring 2018

Commands

The Linux Command Line                

Description                

Part 1 — Paths                

  1. Use the cd command to go to info’s home directory.
  2. What command will tell you where you are? Do it.
  3. Use cd to go to the bin directory under cs253’s home directory.
  4. What command will tell you where you are? Do it.
  5. Use cd to go back to your home directory.

You are copy & pasting all your commands into another file, to show the TA, right? It would be a shame to do all this and not have anything to show to the TA.                 

Part 2 — Viewing Files                

  1. Use cat to view ~info/printers.
  2. Use cat to view ~cs253/pub/hamlet.txt. Did you get all that?
  3. Use less to view ~cs253/pub/hamlet.txt. Use q to exit less.
  4. Use head to view the beginning of ~cs253/pub/hamlet.txt.
  5. Use tail to view the end of ~cs253/pub/hamlet.txt.

Part 3 — Listing files, making files & directories                

A few file commands:

  1. Copy the file dwarfs from ~cs253/pub to your home directory.
  2. Rename it to seven.
  3. Make a new directory called Zulu.
  4. Move seven to that new directory.
  5. Generate a long listing of seven.
  6. Get rid of that new directory.

Part 4 — Commands                

  1. Copy the file dwarfs from ~cs253/pub to your home directory.
  2. How many lines are in dwarfs? Use a command do do the counting. Do not just cat the file and count it yourself.
  3. Use your favorite editor to alter the names of some of the dwarfs in your copy of dwarfs.
  4. Use diff to show the changes you’ve made.
  5. Use grep to find the dwarfs whose names contain a “y”.

Part 5 — Redirection                

  1. Run the date command, sending the output to the file now.
  2. Use cat to add the file ~cs253/pub/dwarfs to the end of now.
  3. Use grep to show the three words in ~cs253/pub/common-words.txt
     that contain “xy”, and then send that output to sort to put them
     in alphabetical order.

Part 6 — Filename Patterns                

  1. List all the files whose names contain a dot.
  2. Copy all the files with six-letter names to your home directory. Do not do the counting yourself. This is a job for a computer. Imagine a directory with hundreds of files in it.

Part 7 — File Permissions                

    
% ls -l ~cs253/pub/dwarfs
-rw-r--r-- 1 cs253 class 45 Aug 28  2022 /s/bach/a/class/cs253/pub/dwarfs
  1. Copy the dwarfs file to your home directory.
  2. In your home directory, execute chmod ug=rw dwarfs to give yourself (the user) and others in your group (other students) read & write access to this file.
  3. Verify those permissions using ls.

Part 8 — Credit                

Show your work to the TA for credit.                 

User: Guest                 

Check: HTML CSS
Edit History Source

Modified: 2018-01-18T09:34                 

Apply to CSU | Contact CSU | Disclaimer | Equal Opportunity
Colorado State University, Fort Collins, CO 80523 USA
© 2018 Colorado State University
CS Building