MBV4410/9410 Fall 2017 Bioinformatics for Molecular Biology More Unix
Transfer files You must be able to transfer files between a Unix server (such as freebee.abel.uio.no or login.abel.uio.no) and your laptop (both ways). You can use software such as WinSCP or Fetch. Or the command line with scp (on Windows you need Cygwin with scp installed).
Copy files to and from UiO home area (Terminal/ Cygwin etc.)
Copy files to and from UiO home area (graphical)
Moving files with the mv command Move file1.txt to directory mvtest Pro tip: mv command can also rename files! ( moves file to a new filename)
Non-printing characters Use cat -v to see invisible characters. Typically End of Line (EOL) characters MS Windows newline character
Non-printing characters EOLs differ between Windows and Unix (including Mac) languages Use dos2unix command to go from MS Windows to Unix Use unix2dos command to do the reverse NB! dos2unix might have to be installed. Already installed on freebee
Everything on a single line!
Delete files with the rm command NB! There s no trash can on Unix! Your files are immediately deleted! Delete empty directories with rm r Delete directories AND files within with rm rf Use with caution!! (rm i)
Viewing files Pro tip: Use the different options to tweak the output cat displays the entire content on the screen less displays the content on the screen one file/line at a time (press q to exit). head/tail displays the first or last lines of a file
Downloading files from the internet The wget command should work on freebee Other options are curl or ftp Right-click and copy the link!
Back up your data! Don t store only on your laptop Use M: on UiO machines (login.uio.no) Same as ~/ in Unix environment ~/pc/desktop on login or freebee is the same as M: on UiO machines
Putty log on to home area
Putty log on to freebee
Graphical interface for file transfer WinSCP (https://winscp.net/) - on the Desktops Fetch (http://fetchsoftworks.com/)
Some interactive exercises on Pipes and Filters Log in to freebee.abel.uio.no Download the file shell-novice-data.zip: wget http://folk.uio.no/jonbra/mbv-inf4410_2017/shell-novicedata.zip Unzip the file. It creates a directory called data-shell. Go into data-shell
Wildcards * Matches zero or more characters? Matches a single character Run wc *.pdb inside molecules
Which ls command produces this output? 1. ls *t*ane.pdb 2. ls *t?ne.* 3. ls *t??ne.pdb 4. ls ethane.*
You have a directory containing the files: 2015-10-23-calibration.txt 2015-10-23-dataset1.txt 2015-10-23-dataset2.txt 2015-10-23-dataset_overview.txt 2015-10-26-calibration.txt 2015-10-26-dataset1.txt 2015-10-26-dataset2.txt 2015-10-26-dataset_overview.txt 2015-11-23-calibration.txt 2015-11-23-dataset1.txt 2015-11-23-dataset2.txt 2015-11-23-dataset_overview.txt You back up the data, and send some of the files to Bob: $ cp *dataset* /backup/datasets $ cp calibration /backup/calibration $ cp 2015- - ~/send_to_bob/all_november_files/ $ cp ~/send_to_bob/all_datasets_created_on_a_23rd/ Fill in the blanks: $ cp *calibration.txt /backup/calibration $ cp 2015-11-* ~/send_to_bob/all_november_files/ $ cp *-23-dataset* ~/send_to_bob/ all_datasets_created_on_a_23rd/
What Does >> Mean? What is the difference between: $ echo hello > testfile01.txt and: $ echo hello >> testfile02.txt Hint: Try executing each command twice in a row and then examining the output files.
Appending data Consider the file data-shell/data/animals.txt. After these commands, select the answer that corresponds to the file animalsupd.txt: $ head -3 animals.txt > animalsupd.txt $ tail -2 animals.txt >> animalsupd.txt 1. The first three lines of animals.txt 2. The last two lines of animals.txt 3. The first three lines and the last two lines of animals.txt 4. The second and third lines of animals.txt
Piping commands together In our current directory, we want to find the 3 files which have the least number of lines. Which command listed below would work? 1. wc -l * > sort -n > head -n 3 2. wc -l * sort -n head -n 1-3 3. wc -l * head -n 3 sort -n 4. wc -l * sort -n head -n 3
Markdown (just for information) https://daringfireball.net/projects/markdown/basics https://www.cs.colorado.edu/~kena/classes/5828/f16/ lectures/04-markdowngithub.pdf Good practice to always write notes in a text file with markdown formatting.