This is the second part of the first computer lab.
01 Working with relative paths
Enter the lab01 directory (again). Now create two directories inside: temp and data. Check with ls that everything is working.
Now we are going to create three files with the following commands:
ls -l / > temp/list.txt ls -l / > data/list.txt cat /proc/cpuinfo > data/processor.txt
Now enter in the data directory.
- Type a command to display the first lines of the list.txt file contained in the temp directory.
- Type a command to display the last three lines of processor.txt contained in your current directory.
- Type a command to display only the lines containing the word “processor” in the processor.txt file.
- Now repeat the command of the previous point, redirecting the output in a file called “cpus.txt” in the temp directory.
To finish this point go to the lab01 (cd ..) and type the following command:
history | tail -n 22 > mycommands.txt
02 Grand Finale
Return to the lab01 directory. Now suppose that you want to print lines from 10 to 20 of the E. coli genome. Knowing how to use head, tail and the pipes… type a command to do that.
Finally repeat the command redirecting the output to a file called coli10-20.txt.
Well done!
Now you can go back home and continue playing with Linux.
Remember to sign the instructor’s sheet before leaving.
See you on Monday