Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

displays all the flags/options available to you - which saves you remembering them all! Try this for each command you've learned so far. Use the spacebar to navigate the manual pages, and q to quit this man output.

Warning

Note: this command is for Mac and Linux users only. It does not work directly for Windows users. If you use windows, you can search for the Shell command on http://man.he.net/, and view the associated manual page. You can also use the help switch --help after a command to display the help documentation. e.g. ls --help

1.1.1: Exercise - Find out about advanced ls commands

...

Here, we will create a new directory and move into it. Make the directory name your uni (this is important for later)'firstdir':

 


Code Block
languagebash
$ mkdir cmh329firstdir 
$ cd cmh329firstdir


 

Here we used the mkdir command (meaning 'make directories') to create a directory named 'cmh329firstdir' (or your uni). Then we moved into that directory using the cd command.

But wait! There's a trick to make things a bit quicker. Let's go up one directory. 


Code Block
languagebash
$ cd ..


 

Instead of typing cd cmh329firstdir, let's try to type cd c (or first letter of your uni) and f and then hit the Tab key. We notice that the shell completes the line to cd cmh329firstdir/.

2.0 Tab for Auto-complete

...

2.1 Reading files

If you are in YourUnifirstdir, use cd .. to get back to the CUL-MWG-Workshop-master directory.

...

Code Block
languagebash
$ mkdir cmh329_results

Now let's try our first search:

...

As before, cycling back and adding > cmh329_ results/, followed by a filename (ideally in .txt format), will save the results to a data file. Go ahead and do this on your own.

...

Code Block
languagebash
$ grep -i metadata *.csv > cmh329_results/2017-02-15_metadata-ecommons.csv

...

Code Block
languagebash
$ grep -iw revolution *.csv > cmh329_results/DATE_JAiw-revolution.csv

...

Code Block
languagebash
$ wc -l cmh329_results/*.csv
     186 cmh329_results/2017-02-15_metadata-ecommons.csv
     162 cmh329_results/DATE_JAiw-revolution.csv
     348 total

...