*** The Linux Shell/Terminal/Putty *** [Note - Holmsted hall, 140] [Advice - ... - Look through a Linux/unix tutorial - Review the list of commands in here - Look through a python/perl/whatever tutorial (whatever language you're dealing with) - Also look at bioperl, biopython, etc. for whatever language] 1. Non-graphical browser. Think of Windows, My Computer... Basic commands... ls - show the files, list ls -l lists the details ls -lh lists the details, with the file size in "human readable" form ls -ltr most recently modified on the bottom ls -lSrh largest on the bottom ls blahblah - lists the files in blahblah directory cd - change directory, that's like double-clicking a folder in My Computer cd .. - .. is like the "up" directory cd . - does nothing, . is the current directory pwd - print working directory, lists the current directory cp - copy command cp whatYouWantToCopy whereYouWantToCopyit cp whatYouWantToCopy whereYouWantToCopyit/newName.blah mv - like copy, but deletes the old file mkdir - make directory mkdir newDirectoryName exit - yep. Looking at files... nano someFile.txt - notes... - Don't nano huge files. head someFile.txt - shows the first few lines tail someFile.txt - shows the last few lines more someFile.txt - shows one screen at a time, press spacebar to scroll down, press q to quit. file permissions - use ls -l to see file permissions. - user who owns the file, group of the user who owns the file, and other - 3 different sets of permissions - each of those can have read, write, and/or execute permissions. - e.g., rwx----- means the owner the user can read, write, execute, nobody else can more file permissions - also, check getfacl someFile - shows access control list - another way to set permissions. If the getfacl show something different than ls -l, getfacl is correct - can set permissions with setfacl - note that directories need to be executable by whoever is going to "go into" the directory, and need to be readable by anyone who is going to list the contents of the directory, and needs to be writeable to be able to create new files in the directory du -h, gives disk usage/free space wc - wordcount, counts # of lines, words, characters in a file diff - can be used to compare two files, showing differences Compressing files... gzip blahDirectory_or_file - zips up a file gunzip - unzips the file lrzip/lrunzip - another compression program tar -cvf someName.tar.gz someDirectory - will "tar" and zip up someDirectory into a file called someName.tar.gz tar -xvf someName.tar.gz someDirectory - does the opposite - unzip/tar's the file into the directory - note the "c" is for create, the "x" is for extract Transferring files... Programs to transfer files between your computer and a server... - On Windows, download winscp or FileZilla - On Mac, download FileZilla - On Unix/Linux/Mac - use the terminal/shell and the sftp command Note that if your upload speed at home is 1 Mb/sec, then a 100MB file will take 100*8 seconds = about 13 minutes Dealing with running commands... ^c, that's hold down control and press c - that kills a program that's running. someCommand & - detaches the command from the terminal. You can do this with programs that don't print to the screen or take keyboard input. - note, if the program actually does need the screen or keyboard, it says that it is "suspended. fg - "foreground" - wakes up a suspended program. top - shows the running programs, how much CPU and memory, ... - type q to quit - type k and then a pid to kill a running program - type u and then a username to see only that user's programs man someCommand - manual, shows help information about the command. - the interface is kine of like more, press q to quit. time someCommand - runs the command and afterwards prints information about how long it took. uptime - now long system has been running since last reboot more /proc/loadavg - shows current CPU workload *** Perl Programming *** 1. Sources of information + Wiki book - http://en.wikibooks.org/wiki/Perl_Programming + Quick reference - http://www.info.univ-angers.fr/~gh/refcards/perlrefcard.pdf - http://webdocs.cs.ualberta.ca/~lindek/perl_quickref.pdf 2. Running a perl program. If you have a perl program, something.pl, you run it by typing perl something.pl Some programs will expect some command-line arguments, then you'd type perl something.pl argument1 argument2 etc. 2. Programming ... Program - some text file with commands for the computer to run. - those commands are written in some computer language. - when you run the program, there is a compiler/interpreter that has to understand what the commands mean, and then make the computer do them. Keep in mind... - What can the computer actually do? (the CPU, i7 or whatever) add, subtract, multiply numbers keep track of a program that it is running from memory go from one part of that program to another ... blah blah - The computer language we use has to get translated into that stuff... - Any programming language will have... + arithmetic + if tests + keep data in variables + while, do/while loops + functions And this is because all the programming languages will end up needing to translate their code into "CPU language", and these are the things that CPUs can do.