Wednesday, October 7, 2015

UNIX Basic Commands

LINUX ESSENTIALS



Index

  1. INTRODUCTION
  2. BASICS
  3. UNIX HELP
  4. FINDING THINGS
  5. PERMISSIONS & OWNERSHIP
  6. USEFUL COMMANDS
  7. JOB/PROCESS MANAGEMENT
  8. TEXT VIEWING
  9. TEXT EDITORS
  10. THE UNIX SHELL
  11. SIMPLE SHELL ONE-LINER SCRIPTS
  12. SIMPLE PERL ONE-LINER SCRIPTS
  13. REMOTE COPY
  14. ARCHIVING AND COMPRESSING
  15. SIMPLE INSTALLS
  16. DEVICES
  17. ENVIRONMENT VARIABLES
  18. EXERCISES


  • INTRODUCTION

  • Why UNIX?
    • Multitasking
    • Remote tasking ("real networking")
    • Multiuser
    • Access to shell, programming languages, databases, open-source projects
    • Better performance, less expensive (free), more up-to-date
    • Many more reasons

    How to get access

    UNIX variants
    • UNIX: Solaris, IRIX, HP-UX, Tru64-UNIX, Free's, LINUX, ...
    LINUX distributions
    • RedHat, Debian, Mandrake, Caldera, Slackware, SuSE, ...

    1. BASICS
    2. Syntax for this manual
        Remember the UNIX/LINUX command line is case sensitive!
        "$" indicates start of command
        "#" indicates end of command and start of comment
        The text in green or red monospace font represents the actual command. The "$" and "#" symbols are not part of it. The commands in red emphasize essential information for beginners.
        "<...>" or "my_..." refers to variables and file names that need to be specified by the user. The arrows "<...>" need to be excluded, because they are generic UNIX redirection functions!

      Login from Windows:

      Login from Mac OS-X or LINUX
      • open terminal and type:

      • $ ssh @
        $ user name: ...
        $ password: ...

      Changing password:
        $ passwd # follow instructions

      Orientation
        $ pwd # present working directory
        $ ls # content of pwd
        $ ll # similar as ls, but provides additional info on files and directories
        $ ll -a # includes hidden files (.name) as well
        $ ll -R # lists subdirectories recursively
        $ ll -t # lists files in chronological order
        $ stat # provides all attributes of a file
        $ whoami # shows as who you are logged in
        $ hostname # shows on which machine you are

      Files and directories
        $ mkdir # creates specified directory
        $ cd # switches into specified directory
        $ cd .. # moves one directory up
        $ cd ../../ # moves two directories up (and so on)
        $ cd # brings you to highest level of your home directory
        $ rmdir # removes empty directory
        $ rm # removes file name
        $ rm -r # removes directory including its content, but asks for confirmation, 'f' argument turns confirmation off
        $ mv # renames directories or files
        $ mv # moves file/directory as specified in path
        $ cp # copy file/directory as specified in path (-r to include content in directories)

      Copy and paste
      • Depends on local environment. Usually one of the following methods works:

      • Copy: Ctrl&Shift&c or right/middle mouse click
        Paste: Ctrl&Shift&p or right/middle mouse click

      Handy shortcuts
        $ . # refers to pwd
        $ ~/ # refers to user's home directory
        $ history # shows all commands you have used recently
        $ ! # starts an old command by providing its ID number
        $ up(down)_key # scrolls through command history
        $ TAB # completes path/file_name
        $ SHIFT&TAB # completes command
        $ Ctrl a # cursor to beginning of command line
        $ Ctrl e # cursor to end of command line
        $ Ctrl d # delete character under cursor
        $ Ctrl k # delete line from cursor, content goes into kill buffer
        $ Ctrl y # paste content from Ctrl k

    3. UNIX HELP
      • $ man # general help
        $ man wc # manual on program 'word count' wc
        $ wc --help # short help on wc
        $ info wc # more detailed information system (GNU)
        $ apropos wc # retrieves pages where wc appears
        Online help: SuperMan Pages, Linux Documentation Project (LDP)

    4. FINDING THINGS
    5. Finding files, directories and applications
        $ find -name "*pattern*" # searches for *pattern* in and below current directory
        $ find /usr/local -name "*blast*" # finds file names *blast* in specfied directory
        $ find /usr/local -iname "*blast*" # same as above, but case insensitive
        additional useful arguments: -user , -group , -ctime
        $ find ~ -type f -mtime -2 # finds all files you have modified in the last two days
        $ locate # finds files and dirs that are written into update file
        $ which # location of application
        $ whereis # searches for executeables in set of directories
        $ dpkg -l | grep mypattern # find Debian packages and refine search with grep pattern

      Finding things in files
        $ grep pattern file # provides lines in 'file' where pattern 'appears', if pattern is shell function use single-quotes: '>'
        $ grep -H pattern # -H prints out file name in front of pattern
        $ grep 'pattern' file | wc # pipes lines with pattern into word count wc (see chapter 8); wc arguments: -c: show only bytes, -w: show only words, -l: show only lines; help on regular expressions: $ man 7 regex or man perlre
        $ find /home/my_dir -name '*.txt' | xargs grep -c ^.* # counts line numbers on many files and records each count along with individual file name; find and xargs are used to circumvent the Linux wildcard limit to apply this function on thousands of files.

    6. PERMISSIONS & OWNERSHIP
    7. How does it work
        $ ls -al # shows something like this for each file/dir: drwxrwxrwx
          d: directory
          rwx: read write execute
          first triplet: user permissions (u)
          second triplet: group permissions (g)
          third triplet: world permissions (o)

      To assign write and execute permissions to user and group:
        $ chmod ug+rx my_file

      To remove all permissions from all three user groups:
        $ chmod ugo-rwx my_file
          '+' causes the permissions selected to be added
          '-' causes them to be removed
          '=' causes them to be the only permissions that the file has.
          Example for number system:
        $ chmod +rx public_html/ or $ chmod 755 public_html/

      Change ownership
        $ chown # changes user ownership
        $ chgrp # changes group ownership
        $ chown : # changes user & group ownership

    8. USEFUL UNIX COMMANDS
      • $ df # disk space
        $ free # memory info
        $ uname -a # shows tech info about machine
        $ bc # command-line calculator (to exit type 'quit')
        $ wget ftp://ftp.ncbi.nih.... # file download from web
        $ /sbin/ifconfig # give IP and other network info
        $ ln -s original_filename new_filename # creates symbolic link to file or directory
        $ du -sh # displays disk space usage of current directory
        $ du -sh * # displays disk space usage of individual files/directories
        $ du -s * | sort -nr # shows disk space used by different directories/files sorted by size

    9. JOB/PROCESS MANAGEMENT
      • $ who # shows who is logged into system
        $ w # shows which users are logged into system and what they are doing
        $ ps # shows processes running by user
        $ ps -e # shows all processes on system; try also '-a' and '-x' arguments
        $ ps aux | grep # shows all processes of one user
        $ top # view top consumers of memory and CPU
        $ mtop # displays multicomputer/CPU processes
        $ Ctrl z bg or fg # suspends a process to bring into back- or foreground
        $ Ctrl c # stops an initiated process
        $ kill # Kills specified job; if this doesn't do it, add -9 as argument. Also, type <%1> then .
        $ renice -n # change priority value, which range from 1-19, the higher the value the lower the priority, default is 10

    10. TEXT VIEWING
      • $ less # more versatile text viewer than 'more', 'G' moves to end of text, 'g' to beginning, '/' find forward, '?' find backwards
        $ more # views text, use space bar to browse, hit 'q' to exit
        $ cat # concatenates files and prints content to standard output

    11. TEXT EDITORS
    12. VI and VIM
        Non-graphical (terminal-based) editor. Vi is guaranteed to be available on any system. Vim is the improved version of vi.

      EMACS
        Window-based editor. You still need to know keystroke commands to use it. Installed on all Linux distributions and on most other Unix systems.

      XEMACS
        More sophisticated version of emacs, but usually not installed by default. All common commands are available from menus. Very powerful editor, with built-in syntax checking, Web-browsing, news-reading, manual-page browsing, etc.

      PICO
        Simple terminal-based editor available on most versions of Unix. Uses keystroke commands, but they are listed in logical fashion at bottom of screen.

      VIM MANUAL (essentials marked in red)
      BASICS
        $ vim my_file_name # open/create file with vim
        $ i # INSERT MODE
        $ ESC # NORMAL (NON-EDITING) MODE
        $ : # commands start with ':'
        $ :w # save command; if you are in editing mode you have to hit ESC first!!
        $ :q # quit file, don't save
        $ :q! # exits WITHOUT saving any changes you have made
        $ :wq # save and quit
        $ R # replace MODE
        $ r # replace only one character under cursor
        $ q: # history of commands (from NORMAL MODE!), to reexecute one of them, select and hit enter!
        $ :w new_filename # saves into new file
        $ :#,#w new_filename # saves specific lines (#,#) to new file
        $ :# go to specified line number

      HELP
        $ Useful list of vim commands: Vim Commands Cheat Sheet, VimCard, Vim Basics
        $ vimtutor # open vim tutorial from shell
        $ :help # opens help within vim, hit :q to get back to your file
        $ :help # opens help on specified topic
        $ |help_topic| CTRL-] # when you are in help this command opens help topic specified between |...|, CTRL-t brings you back to last topic
        $ :help CTRL-D # gives list of help topics that contain key word
        $ : # like in shell you get recent commands!!!!

      MOVING AROUND IN FILE
        $ $ # moves cursor to end of line
        $ A # same as $, but switches to insert mode
        $ 0 (zero) # moves cursor to beginning of line
        $ CTRL-g # shows at status line filename and the line you are on
        $ SHIFT-G # brings you to bottom of file, type line number (isn't displayed) then SHIFT-G # brings you to specified line#

      DISPLAY
        WRAPPING AND LINE NUMBERS
        $ :set nowrap # no word wrapping, :set wrap # back to wrapping
        $ :set number # shows line numbers, :set nonumber # back to no-number mode

      WORKING WITH MANY FILES & SPLITTING WINDOWS
        $ vim *.txt # opens many files at once; ':n' switches between files
        $ :wall or :qall # write or quit all open files
        $ vim -o *.txt # opens many files at once and displays them with horizontal split, '-O' does vertical split
        $ :args *.txt # places all the relevant files in the argument list $ :all # splits all files in the argument list (buffer) horizontally $ CTRL-w # switch between windows
        $ :split # shows same file in two windows
        $ :split # opens second file in new window
        $ :vsplit # splits windows vertically, very useful for tables, ":set scrollbind" let's you scroll all open windows symultaneously
        $ :close # closes current window
        $ :only # closes all windows except current one

      SPELL CHECKING & Dictionary
        $ aspell -c # shell command
        $ aspell -l # shell command
        $ :! dict # meaning of word
        $ :! wn 'word' -over # synonyms of word

      PRINTING FILE
        $ :ha # prints entire file
        $ :#,#ha # prints specified lines: #,#

      MERGING/INSERTING FILES
        $ :r # inserts content of specified file after cursor

      UNDO/REDO
        $ u # undo last command
        $ U # undo all changes on current line
        $ CTRL-R # redo one change which was undone

      DELETION/CUT (switch to NORMAL mode)
        $ x # deletes what is under cursor
        $ dw # deletes from curser to end of word including the space
        $ de # deletes from curser to end of word NOT including the space
        $ cw # deletes rest of word and lets you then insert, hit ESC to continue with NORMAL mode
        $ c$ # deletes rest of line and lets you then insert, hit ESC to continue with with NORMAL mode
        $ d$ # deletes from cursor to the end of the line
        $ dd # deletes entire line
        $ 2dd # deletes next two lines, continues: 3dd, 4dd and so on.

      PUT (PASTE)
        $ p # uses what was deleted/cut and pastes it behind cursor

      COPY & PASTE
        $ yy # copies line, for copying several lines do 2yy, 3yy and so on
        $ p # pastes clipboard behind cursor

      SEARCH IN FILE (most regular expressions work)
        $ /my_pattern # searches for my_pattern downwards, type n for next match
        $ ?my_pattern # seraches for my_pattern upwards, type n for next match
        $ :set ic # switches to ignore case search (case insensitive)
        $ :set hls # switches to highlight search (highlights search hits)

      REPLACE WITH REGULAR EXPRESSIONS (great intro: A Tao of Regular Expressions)
        $ :s/old_pat/new_pat/ # replaces first occurence in a line
        $ :s/old_pat/new_pat/g # replaces all occurence in a line
        $ :s/old_pat/new_pat/gc # add 'c' to ask for confirmation
        $ :#,#s/old_pat/new_pat/g # replaces all occurence between line numbers: #,#
        $ :%s/old_pat/new_pat/g # replaces all occurence in file
        $ :%s/\(pattern1\)\(pattern2\)/\1test\2/g # regular expression to insert, you need here '\' in front of parentheses (<# Perl)
        $ :%s/\(pattern.*\)/\1 my_tag/g # appends something to line containing pattern (<# .+ from Perl is .* in VIM)
        $ :%s/\(pattern\)\(.*\)/\1/g # removes everything in lines after pattern
        $ :%s/\(At\dg\d\d\d\d\d\.\d\)\(.*\)/\1\t\2/g # inserts tabs between At1g12345.1 and Description
        $ :%s/\n/new_pattern/g #Replaces return signs
        $ :%s/pattern/\r/g #Replace pattern with return signs!!
        $ :%s/\(\n\)/\1\1/g # insert additional return signs
        $ :%s/\(^At\dg\d\d\d\d\d.\d\t.\{-}\t.\{-}\t.\{-}\t.\{-}\t\).\{-}\t/\1/g # replaces content between 5th and 6th tab (5th column), '{-}' turns off 'greedy' behavior
        $ :#,#s/\( \{-} \|\.\|\n\)/\1/g # performs simple word count in specified range of text
        $ :%s/\(E\{6,\}\)/\1<\/font>/g # highlight pattern in html colors, here highlighting of >= 6 occurences of Es
        $ :%s/\([A-Z]\)/\l\1/g # change uppercase to lowercase, '%s/\([A-Z]\)/\u\1/g' does the opposite
        $ :g/my_pattern/ s/\([A-Z]\)/\l\1/g | copy $ # uses 'global' command to apply replace function only on those lines that match a certain pattern. The 'copy $' command after the pipe '|' prints all matching lines at the end of the file.
        $ :args *.txt | all | argdo %s/\old_pat/new_pat/ge | update # Command 'args' places all relevant files in the argument list (buffer); 'all' displays each file in separate split window; command 'argdo' applies replacement to all files in argument list (buffer); flag 'e' is necessary to avoid stop at error messages for files with no matches; command 'update' saves all changes to files that were updated.

      MATCHING PARENTHESES SEARCH
        - place curser on (, [ or { and type % # curser moves to matching parentheses

      HTML EDITING
        -Convert text file to html format:
        $ :runtime! syntax/2html.vim # run this command with open file in Vim

      SHELL COMMAND IN VIM
        $ :! # executes any shell command, hit to return
        $ :sh # switches window to shell, 'exit' switches back to vim

      USING VIM AS TABLE EDITOR
        $ v # starts visual mode for selecting characters
        $ V # starts visual mode for selecting lines
        $ CTRL-V # starts visual mode for selecting blocks (use CTRL-q in gVim under Windows). This allows column-wise selections and operations like inserting and deleting columns. To restrict substitude commands to a column, one can select it and switch to the command-line by typing ':'. After this the substitution sytax for a selected block looks like this: '<,'>s///.
        $ :set scrollbind # starts simultaneous scrolling of 'vsplitted' files. To set to horizontal binding of files, use command ':set scrollopt=hor' (after first one). Run all these commands before the ':split' command.
        $ :AlignCtrl I= \t then :%Align # This allows to align tables by column separators (here '\t') when the Align utility from Charles Campbell's is installed.
        To sort table rows by selected lines or block, perform the visual select and then hit F3 key. The rest is interactive. To enable this function one has to include in the .vimrc file from Gerald Lai the Vim sort script.

      MODIFY VIM SETTINGS (in file .vimrc)
        - see last chapter of vimtutor (start from shell)
        - useful .vimrc sample
        - when vim starts to respond very slowly then one may need to delete the .viminf* files in home directory

    13. THE UNIX SHELL
    14. When you log into UNIX/LINUX the system starts a program called SHELL. It provides you with a working environment and interface to the operating system. Usually there are many different shell programs installed.
        $ finger # shows which shell you are using
        $ chsh -l # gives list of shell programs available on your system (does not work on all UNIX variants)
        $ # switches to different shell

      STDIN, STDOUT, STDERR, REDIRECTORS, OPERATORS & WILDCARDS (more on this @ LINUX HOWTOs)
        By default, many UNIX commands read from standard input (STDIN) and send their output to standard out (STDOUT). You can redirect them by using the following commands:
        $ file* # * is wildcard to specify many files
        $ ls > file # prints ls output into specified file
        $ command < my_file # uses file after '<' as STDIN
        $ command >> my_file # appends output of one command to file
        $ command | tee my_file # writes STDOUT to file and prints it to screen; alternative way to do this:
        $ command > my_file; cat my_file
        $ command > /dev/null # turns off progress info of applications by redirecting their output to /dev/null
        $ grep my_pattern my_file | wc # Pipes (|) output of 'grep' into 'wc'
        $ grep my_pattern my_non_existing_file 2 > my_stderr # prints STDERR to file

      Useful shell commands
        $ cat > # concatenate files in output file 'cat.out'
        $ paste > # merges lines of files and separates them by tabs (useful for tables)
        $ cmp # tells you whether two files are identical
        $ diff # finds differences between two files
        $ head - # prints first lines of a file
        $ tail - # prints last lines of a file
        $ split -l # splits lines of file into many smaller ones
        $ csplit -f out fasta_batch "%^>%" "/^>/" "{*}" # splits fasta batch file into many files at '>'
        $ sort # sorts single file, many files and can merge (-m) them, -b ignores leading white space, ...
        $ sort -k 2,2 -k 3,3n input_file > output_file # sorts in table column 2 alphabetically and column 3 numerically, '-k' for column, '-n' for numeric
        $ sort input_file | uniq > output_file # uniq command removes duplicates and creates file/table with unique lines/fields
        $ join -1 1 -2 1 # joins two tables based on specified column numbers (-1 file1, 1: col1; -2: file2, col2). It assumes that join fields are sorted. If that is not the case, use the next command:
        $ sort table1 > table1a; sort table2 > table2a; join -a 1 -t "`echo -e '\t'`" table1a table2a > table3 # '-a ' prints all lines of specified table! Default prints only all lines the two tables have in common. '-t "`echo -e '\t'`" ->' forces join to use tabs as field separator in its output. Default is space(s)!!!
        $ cat my_table | cut -d , -f1-3 # cut command prints only specified sections of a table, -d specifies here comma as column separator (tab is default), -f specifies column numbers.
        $ grep and egrep # see chapter 4

    15. SIMPLE SHELL ONE-LINER SCRIPTS
    16. Useful One-Liners (script download)
        $ for i in *.input; do mv $i ${i/name\.old/name\.new}; done # renames file name.old to name.new
        - To test things first, insert 'echo' between 'do mv' (above).
        $ for i in *.input; do ./application $i; done # runs application in loops on many input files
        $ for i in *.input; do fastacmd -d /data/../database_name -i $i > $i.out; done # runs fastacmd in loops on many *.input files and creates *.out files
        $ for i in *.pep; do target99 -db /usr/../database_name -seed $i -out $i; done # runs SAM's target99 on many input files
        $ for j in 0 1 2 3 4 5 6 7 8 9; do grep -iH *$j.seq; done # searches in > 10,000 files for pattern and prints occurences together with file names.
        $ for i in *.pep; do echo -e "$i\n\n17\n33\n\n\n" | ./tmpred $i > $i.out; done # example of how to run an interactive application (tmpred) that asks for file name input/output
        $ for i in *.fasta1; do blast2 -p blastp -i $i -j ${i/_*fasta1/_*fasta2} >> my_out_file; done # runs BLAST2 for all *.fasa1/*.fasta2 file pairs in the order specified by file names and writes results into one file. This example uses two variables in a for loop. The content of the second variable gets specified in each loop by a replace function.
        $ for i in *.fasta; do for j in *.fasta; do blast2 -p blastp -F F -i $i -j $j >> my_out_file; done; done; # runs BLAST2 in all-against-all mode and writes results into one file; '-F F' turns low-complexity filter off

      How to write a script
        - create file which contains in first line:
        #!/bin/bash
        - place shell commands in file
        - run to make it executable
        - run shell script like this: ./my_shell_script
        - when you place it into /usr/local/bin you only type its name from any user account

    17. SIMPLE PERL ONE-LINER SCRIPTS
    18. Useful One-Liners
        $ perl -p -i -w -e 's/pattern1/pattern2/g' input_file # replace something (e.g. return signs) in file using regular expressions; use $1 to backreference to pattern placed in parentheses
        '-p' lets perl know to write program; '-i.bak' creates backup file *.bak, only -i doesn't; '-w' turns on warnings; '-e' executeable code follows
        $ perl -ne 'print if (/my_pattern1/ ? ($c=1) : (--$c > 0)) ; print if (/my_pattern2/ ? ($d = 1) : (--$d > 0))' my_infile > my_outfile # parses lines that contain pattern1 and pattern2
        following lines after pattern can be specified in '$c=1' and '$d=1'; for OR function use this syntax: '/(pattern1|pattern2)/'

    19. REMOTE COPY: WGET, SCP and NCFTP
    20. WGET (file download from the www)
        $ wget ftp://ftp.ncbi.nih.... # file download from www; add option '-r' to download entire directories

      SCP (secure copy between machines)
        General syntax
        $ scp source target # Use form 'userid@machine_name' if your local and remote user ids are differnt. If they are the same you can use only 'machine_name'.

        Examples
        Copy file from Server to Local Machine (type from local machine prompt):
        $ scp user@remote_host:file.name . # '.' copies to pwd, you can specify here any directory, use wildcards to copy many files at once.
        Copy file from Local Machine to Server:
        $ scp file.name user@remote_host:~/dir/newfile.name
        Copy entire directory from Server to Local Machine (type from local machine prompt):
        $ scp -r user@remote_host:directory/ ~/dir
        Copy entire directory from Local Machine to Server (type from local machine prompt):
        $ scp -r directory/ user@remote_host:directory/
        Copy between two remote hosts (e.g. from bioinfo to cache):
        similar as above, just be logged in one of the remote hosts:
        $ scp -r directory/ user@remote_host:directory/

      NICE FTP
        $ open ncftp
        $ ncftp> open ftp.ncbi.nih.gov
        $ ncftp> cd /blast/executables
        $ ncftp> get blast.linux.tar.Z (skip extension: @)
        $ ncftp> bye

    21. ARCHIVING AND COMPRESSING
    22. Archiving and compressing
        $ tar -cvf my_file.tar mydir/ # Builds tar archive of files or directories. For directories, execute command in parent directory. Don't use absolute path.
        $ tar -czvf my_file.tgz mydir/ # Builds tar archive with compression of files or directories. For directories, execute command in parent directory. Don't use absolute path.

      Viewing Archives
        $ tar -tvf my_file.tar
        $ tar -tzvf my_file.tgz

      Extracting
        $ tar -xvf my_file.tar
        $ tar -xzvf my_file.tgz
        $ gunzip my_file.tar.gz # or unzip my_file.zip, uncompress my_file.Z, or bunzip2 for file.tar.bz2
        $ find -name '*.zip' | xargs -n 1 unzip # this command usually works for unziping many files that were compressed under Windows
        try also:
          $ tar zxf blast.linux.tar.Z
          $ tar xvzf file.tgz
        options:
          f: use archive file
          p: preserve permissions
          v: list files processed
          x: exclude files listed in FILE
          z: filter the archive through gzip

    23. SIMPLE INSTALLS
    24. Systems-wide installations
        Installations for systems-wide usage are the responsibility of system administrator
        To find out if an application is installed, type:
        $ which
        $ whereis # searches for executeables in set of directories, doesn't depend on your path
        Most applications are installed in /usr/local/bin or /usr/bin. You need root permissions to write to these directories.
        Perl scripts go into /usr/local/bin, Perl modules (*.pm) into /usr/local/share/perl/5.8.0/. To copy executables in one batch, use command: cp `find -perm -111 -type f` /usr/local/bin

      Applications in user accounts
        Create a new directory, download application into this directory, unpack it (see chapter 13) and follow package-specific installation instructions.
        Usually you can then already run this application when you specify its location e.g.: /home/user/my_app/blastall.
        If you want you can add this directory to your PATH by typing from this directory:
        $ PATH=.:$PATH; export PATH # this allows you to run application by providing only its name; when you do echo $PATH you will see .: added to PATH.

      Intstallation of RPMs
        $ rpm -i application_name.rpm
        To check which version of RPM package is installed, type:
        $ rpm --query
        Help and upgrade files for RPMs can be found at http://rpmfind.net/.

      Installation of Debian packages
        Check whether your application is available at: http://www.debian.org/intro/about, then you type (no download):
        $ apt-cache search phylip #searches for application "phylip" from command line
        $ apt-cache show phylip #provides description of program
        $ apt-get install phylip # example for phylip install, manuals can be found in /usr/doc/phylip/, use zless or lynx to read documentation (don't unzip).
        $ apt-get update # do once a month do update Debian packages
        $ apt-get upgrade -u # to upgrade after update from above
        $ dpkg -i # install data package from local package file (e.g. after download)
        $ aptitude # Debian package manageing interface (Ctrl-t opens menues)
        $ aptitude search vim # search for packages on system and in Debian depositories

    25. DEVICES
    26. Mount/unmount usb/floppy/cdrom
        $ mount /media/usb
        $ umount /media/usb
        $ mount /media/cdrom
        $ eject /media/cdrom
        $ mount /media/floppy

    27. ENVIRONMENT VARIABLES
      • $ xhost user@host # adds X permissions for user on server.
        $ echo DISPLAY # shows current display settings
        $ export (setenv) DISPLAY=:0 # change environment variable
        $ unsetenv DISPLAY # removes display variable
        $ printenv # prints all environment variables
        $ $PATH # list of directories that the shell will search when you type a command
        - You can edit your default DISPLAY setting for your account by adding it to file .bash_profile.

    28. EXERCISES
    29. Exercise 1
      1. Download proteome of Halobacterium spec. from ftp://ftp.ncbi.nih.gov/genbank/genomes/Bacteria/Halobacterium_sp/AE004437.faa (use wget or web browser for download)
      2. How many predicted proteins are there?
        • $ grep '>' AE004437.faa | wc
      3. How many proteins contain the pattern "WxHxxH[1-2]"?
        • $ egrep 'W.H..H{1,2}' AE004437.faa | wc
      4. Use the find function (/) in 'less' to fish out the proteins containing this pattern or more elegantly do it with awk:
        • $ awk --posix -v RS='>' '/W.H..(H){1,2}/ { print ">" $0;}' AE004437.faa | less
      5. Create a BLASTable database with formatdb
        • $ formatdb -i AE004437.faa -p T -o T
          '-p F' for nucleotide and '-p T' for protein databases
      6. Generate list of sequence IDs for above pattern match result and retrieve its sequences with fastacmd from formatted database
        • $ fastacmd -d AE004437.faa -i my_IDs > seq
      7. Generate several lists of sequence IDs from various pattern match results and retrieve their sequences in one step using the fastacmd in for loop
        • $ for i in *.my_ids; do fastacmd -d AE004437.faa -i $i > $i.out; done
      8. Run blastall with a few proteins against newly created database or against Halobacterium or UniProt database (/data/UNIPROT/blast/uniprot)
        • $ blastall -p blastp -i input.file -d AE004437.faa -o blastp.out -e 1e-6 -v 10 -b 10 &
      9. Parse blastall output into Excel spread sheet:
        • a) using biocore parser
          $ blastParse -c -i -o
          b) using BioPerl parser
          $ bioblastParse.pl blast.out
      10. Run HMMPFAM search with above proteins against Pfam database
        • $ hmmpfam -E 0.1 --acc -A0 /data/PFAM/Pfam_ls input.file > output.pfam
          Parse result with BioPerl parser
          $ hmmSummary output.pfam > hmm.summary
      Exercise 2
      1. Split sample fasta batch file with csplit (use sequence file from exercise 1).
      2. Concatenate single fasta files from (1) to one batch file.
      3. BLAST two related sequences, retrieve the result in table format and use join to identify common hit IDs in the two tables.
      Exercise 3
      1. write a shell script that executes several BLAST searches at once:
        • #!/bin/sh
          blastall -p blastp -d /.../my_database -i /.../my_input -o my_out -e 1e-6 -v 10 -b 10 &
          blastall -p blastp -d /.../my_database -i /.../my_input -o my_out -e 1e-6 -v 10 -b 10 &
      Exercise 4
      1. Create multiple alignment with ClustalW (e.g. use sequences with 'W.H..HH' pattern)
        • $ clustalw my_fasta_batch
      Exercise 5
      1. Reformat alignment into PHYILIP format using 'seqret' from EMBOSS
        • $ seqret clustal::my_align.aln phylip::my_align.phylip
      Exercise 6
      1. Create neighbor-joining tree with PHYLIP
        • $ cp my_align.phylip infile
          $ phylip protdist # creates distance matrix
          $ cp outfile infile
          $ phylip neighbor # use default settings
          $ cp outtree intree
          $ phylip retree # displays tree and can use midpoint method for defining root of tree, my typical command sequence is: 'N' 'Y' 'M' 'W' 'R' 'R' 'X'
          $ cp outtree my_tree.dnd
          View your tree in TreeBrowse or open it in TreeView

    Thursday, October 1, 2015

    NFS Cheat Sheet

    LINUX

    NFS Cheat Sheet


    NFS Shares

    Update Exports

    After editing /etc/exports run
    exportfs -a

    List Exports


    # showmount -e
    Export list for myserver:
    /export/home       10.1.0.0/24
    #

    Show Clients

    On the NFS server run 'showmount' to see mounting clients
    # showmount 
    Hosts on myserver:
    10.1.0.15
    #

    List Protocols/Services

    To list local services run:
    # rpcinfo -p
       program vers proto   port  service
        100000    4   tcp    111  portmapper
        100000    3   tcp    111  portmapper
        100000    2   tcp    111  portmapper
        100000    4   udp    111  portmapper
        100000    3   udp    111  portmapper
        100000    2   udp    111  portmapper
        100024    1   udp  48555  status
        100024    1   tcp  49225  status
        100003    2   tcp   2049  nfs
        100003    3   tcp   2049  nfs
        100003    4   tcp   2049  nfs
        100227    2   tcp   2049
        100227    3   tcp   2049
        100003    2   udp   2049  nfs
        100003    3   udp   2049  nfs
        100003    4   udp   2049  nfs
        100227    2   udp   2049
        100227    3   udp   2049
        100021    1   udp  51841  nlockmgr
        100021    3   udp  51841  nlockmgr
        100021    4   udp  51841  nlockmgr
        100021    1   tcp  37319  nlockmgr
        100021    3   tcp  37319  nlockmgr
        100021    4   tcp  37319  nlockmgr
        100005    1   udp  57376  mountd
        100005    1   tcp  37565  mountd
        100005    2   udp  36255  mountd
        100005    2   tcp  36682  mountd
        100005    3   udp  54897  mountd
        100005    3   tcp  51122  mountd
    
    Above output is from an NFS server. You can also run it for remote servers by passing an IP. NFS clients usually just run status and portmapper:
    # rpcinfo -p 10.1.0.15
       program vers proto   port  service
        100000    4   tcp    111  portmapper
        100000    3   tcp    111  portmapper
        100000    2   tcp    111  portmapper
        100000    4   udp    111  portmapper
        100000    3   udp    111  portmapper
        100000    2   udp    111  portmapper
        100024    1   udp  44152  status
        100024    1   tcp  53182  status
    

    NFSv4

    Mounting NFSv4 Shares

    The difference in mounting is that you need to provide "nfs4" and transport and port options like this:
    mount -t nfs4 -o proto=tcp,port=2049 server:/export/home /mnt

    Ensure Running Id Mapper

    When using NFSv4 share ensure to have the id mapper running on all clients. On Debian you need to explicitely start it:
    service idmapd start

    Mapping Users

    You might want to set useful NFSv4 default mappings and some explicit mappings for unknown users:
    #cat /etc/idmapd.conf
    [...]
    [Mapping]
    Nobody-User = nobody
    Nobody-Group = nogroup
    
    [Static]
    someuser@otherserver = localuser
    

    Tuning

    Tuning NFS Clients

    When optimizing for performance try the following client mount option changes:
    • Use "hard" instead of "soft"
    • Add "intr" to allow for dead server and killable client programs
    • Increase "mtu" to maximum
    • Increase "rsize" and "wsize" to maximum supported by clients and server
    • Remove "sync"
    After changing and remounting check for effective options using "nfsstat -m" which will give you a list like this:
    $ nfsstat -m
    /data from 10.1.0.16:/data
     Flags: rw,relatime,vers=4.0,rsize=1048576,wsize=1048576,namlen=255,hard,proto=tcp,port=0,timeo=600,retrans=2,sec=sys,clientaddr=10.1.0.16,local_lock=none,addr=10.1.0.15
    $
    
    When synchronous shares are important try the "noac" mount option.

    Tuning NFS Server

    For the exported filesystem mount options:
    • Use "noatime"
    • Use "async" if you can (risk of data corruption)
    • Use "no_subtree_check"
    Other than that:
    • Use CFQ I/O scheduler
    • Increase /sys/block/sda/device/block/sda/queue/max_sectors_kb
    • Check /sys/block/sda/device/block/sda/queue/read_ahead_kb
    • Increase number of nfsd threads

    Getting NFS Statistics

    Use "nfsstat" for detailed NFS statistics! The options are "-c" for client and "-s" for server statistics. On the server caching statistics are most interesting,
    # nfsstat -o rc
    Server reply cache:
    hits       misses     nocache
    0          63619      885550  
    #
    on the client probably errors and retries. Also note that you can get live per-interval results when running with "--sleep=". For example
    # nfsstat -o fh --sleep=2

    Linux-Networking Cheat Sheet

    Linux-Networking Cheat Sheet

    Basics

    • Resolve a name via nsswitch
      getent hosts 
       
    • DNS Lookup
      dig 
      dig  +noall +answer
      dig  +short
      dig MX 
      dig NS 
      dig ANY 
      
      dig -x 
      dig -x  +short
      
      dig @8.8.8.8 
      
      dig -f input.txt +noall +answer
      
    • netcat Commands
      nc -l -p   # Listen on port
      nc -w3   # Listen for connection from IP on port
      
      # Search banners
      echo | nc -v -n -w1  -
      
      # Port scan
      nc –v –n –z –w1  -
      
    • ethtool - Usage
      ethtool eth0                       # Print general info on eth0
      ethtool -i eth0                    # Print kernel module info
      ethtool -S eth0                    # Print eth0 traffic statistics
      ethtool -a eth0                    # Print RX, TX and auto-negotiation settings
      ethtool -p eth0                    # Blink LED
      
      # Changing NIC settings...
      ethtool -s eth0 speed 100
      ethtool -s eth0 autoneg off
      ethtool -s eth0 duplex full
      ethtool -s eth0 wol g               # Turn on wake-on-LAN
      
      Do not forget to make changes permanent in e.g. /etc/network/interfaces.
    • ip - Usage
      ip link show
      ip link set eth0 up
      ip addr show
      ip neigh show
      
    • miitool - Show Link Infos
      # mii-tool -v
      eth0: negotiated 100baseTx-FD flow-control, link ok
        product info: vendor 00:07:32, model 17 rev 4
        basic mode:   autonegotiation enabled
        basic status: autonegotiation complete, link ok
        capabilities: 1000baseT-HD 1000baseT-FD 100baseTx-FD 100baseTx-HD 10baseT-FD 10baseT-HD
        advertising:  100baseTx-FD 100baseTx-HD 10baseT-FD 10baseT-HD flow-control
        link partner: 1000baseT-HD 1000baseT-FD 100baseTx-FD 100baseTx-HD 10baseT-FD 10baseT-HD flow-control
      
    • Enable Jumbo Frames
      ifconfig eth1 mtu 9000
    • ipsets - Using IP sets for simpler iptables rules
      ipset create smtpblocks hash:net counters
      ipset add smtpblocks 27.112.32.0/19
      ipset add smtpblocks 204.8.87.0/24
      iptables -A INPUT -p tcp --dport 25 -m set --match-set smtpblocks src -j DROP
       
    • iptables - Loopback Routing:
      iptables -t nat -A POSTROUTING -d  -s  -p tcp --dport 80 -j SNAT --to-source 
    • iptables - Show active rules:
      iptables -S
      iptables -L 
      iptables -L 
    • iptables - Full flush:
      iptables -F
      iptables -X
      iptables -t nat -F
      iptables -t nat -X
      iptables -t mangle -F
      iptables -t mangle -X
      iptables -P INPUT ACCEPT
      iptables -P FORWARD ACCEPT
      iptables -P OUTPUT ACCEPT
    • iptables - Allow established:
      iptables -A INPUT -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT
    • iptables - Log failed requests:
      iptables -I INPUT 5 -m limit --limit 5/min -j LOG --log-prefix "iptables denied: " --log-level 7
    • iptables - Persistency on Debian:
      apt-get install iptables-persistent
      
      # Set some rules and call
      invoke-rc.d iptables-persistent save
      
    • iptables - Persistency on Ubuntu: UFW (Uncomplicated FireWall)
      ufw enable
      ufw status
      ufw allow ssh/tcp
      ufw allow from  proto tcp to any port 
      ufw delete allow from  proto tcp to any port 
      
    • fail2ban CLI Commands
      fail2ban-client status
      fail2ban-client status 

    Troubleshooting

    • Black Hole Route: To block IPs create route on loopback
      route add -net 91.65.16.0/24 gw 127.0.0.1 lo   # for a subnet
      route add  91.65.16.4 gw 127.0.0.1 lo   # for a single IP
    • Quick Access Log IP Top List
      tail -100000 access.log | awk '{print $1}' | sort | uniq -c |sort -nr|head -25
    • Find out if IP is used before configuring it
      arping 
    • Traceroute with AS and network name lookup
      lft -AN www.google.de
    • Manually lookup AS

    Measuring

    • vnstat - Short term measurement bytes/packets min/avg/max:
      vnstat -l      # Live listing until Ctrl-C and summary
      vnstat -tr     # 5s automatic traffic sample
    • vnstat - Long term statistics:
      vnstat -h      # last hours (including ASCII graph)
      vnstat -d      # last days
      vnstat -w      # last weeks
      vnstat -m     # last months
      
      vnstat -t       # top 10 days
    • curl - Time details on HTTP requests:
      curl -w "DNS: %{time_namelookup} Connect: %{time_connect} start:  %{time_starttransfer} total:  %{time_total}\n" -o /dev/null -s http://example.com

    Discovery

    • LLDP
      lldpctl
      lldpctl eth0
    • nmap commands
      # Network scan
      nmap -sP 192.168.0.0/24
      
      # Host scan
      nmap 
      nmap -F       # fast
      nmap -O      # detect OS
      nmap -sV      # detect services and versions
      nmap -sU      # detect UDP services
      
      # Alternative host discovery
      nmap -PS      # TCP SYN scan
      nmap -PA      # TCP ACK scan
      nmap -PO      # IP ping
      nmap -PU      # UDP ping
      
      # Alternative service discovery
      nmap -sS       
      nmap -sT 
      nmap -sA 
      nmap -sW 
      
      # Checking firewalls
      nmap -sN 
      nmap -sF 
      nmap -sX 
      

    Debugging

    • iptraf - Real-time statistics in ncurses interfaces
    • mtr - Debug routing/package loss issues
    • netstat - The different modes
      # Typically used modes
      netstat -rn          # List routes
      netstat -tlnp       # List all open TCP connections
      netstat -tlnpc      # Continuously do the above
      netstat -tulpen    # Extended connection view
      netstat -a           # List all sockets
      
      # And more rarely used
      netstat -s            # List per protocol statistics
      netstat -su          # List UDP statistics
      netstat -M           # List masqueraded connections
      netstat -i            # List interfaces and counters
      netstat -o           # Watch time/wait handling
       
    • nttcp - TCP performance testing
      # On sending host
      nttcp -t -s
      
      # On receiving host
      nttcp -r -s
       
    • List Kernel Settings
      sysctl net
       
    • SNMP - Dump all MIBs: When you need to find the MIB for an object known only by name try
      snmpwalk -c public -v 1 -O s  .iso | grep 
    • tcpdump - Be verbose and print full package hex dumps:
       tcpdump -i eth0 -nN -vvv -xX -s 1500 port 
    • tcpdump - Non-promiscuous mode to list only traffic that the network stack processes:
      tcpdump -e ...
    • tcpdump - : Many usage examples.
      # Filter port
      tcpdump port 80
      tcpdump src port 1025 
      tcpdump dst port 389
      tcpdump portrange 21-23
      
      # Filter source or destination IP
      tcpdump src 10.0.0.1
      tcpdump dest 10.0.0.2
      
      # Filter  everything on network 
      tcpdump net 1.2.3.0/24
      
      # Logically operators
      tcpdump src port 1025 and tcp 
      
      # Provide full hex dump of captured HTTP packages
      tcpdump -s0 -x port 80
      
      # Filter TCP flags (e.g. RST)
      tcpdump 'tcp[13] & 4!=0'
      

    Basic Linux Commands

    Basic Linux Commands

    CommandExampleDescription
    cat
    Sends file contents to standard output. This is a way to list the contents of short files to the screen. It works well with piping.

    cat .bashrcSends the contents of the ".bashrc" file to the screen.
    cd
    Change directory

    cd /homeChange the current working directory to /home. The '/' indicates relative to root, and no matter what directory you are in when you execute this command, the directory will be changed to "/home".

    cd httpdChange the current working directory to httpd, relative to the current location which is "/home". The full path of the new working directory is "/home/httpd".

    cd ..Move to the parent directory of the current directory. This command will make the current working directory "/home.

    cd ~Move to the user's home directory which is "/home/username". The '~' indicates the users home directory.
    cp
    Copy files

    cp myfile yourfileCopy the files "myfile" to the file "yourfile" in the current working directory. This command will create the file "yourfile" if it doesn't exist. It will normally overwrite it without warning if it exists.

    cp -i myfile yourfileWith the "-i" option, if the file "yourfile" exists, you will be prompted before it is overwritten.

    cp -i /data/myfile .Copy the file "/data/myfile" to the current working directory and name it "myfile". Prompt before overwriting the file.

    cp -dpr srcdir destdirCopy all files from the directory "srcdir" to the directory "destdir" preserving links (-p option), file attributes (-p option), and copy recursively (-r option). With these options, a directory and all it contents can be copied to another directory.
    dddd if=/dev/hdb1 of=/backup/ Disk duplicate. The man page says this command is to "Convert and copy a file", but although used by more advanced users, it can be a very handy command. The "if" means input file, "of" means output file.
    df
    Show the amount of disk space used on each mounted filesystem.
    lessless textfileSimilar to the more command, but the user can page up and down through the file. The example displays the contents of textfile.
    ln
    Creates a symbolic link to a file.

    ln -s test symlinkCreates a symbolic link named symlink that points to the file test Typing "ls -i test symlink" will show the two files are different with different inodes. Typing "ls -l test symlink" will show that symlink points to the file test.
    locate
    A fast database driven file locator.

    slocate -uThis command builds the slocate database. It will take several minutes to complete this command. This command must be used before searching for files, however cron runs this command periodically on most systems.

    locate whereisLists all files whose names contain the string "whereis".
    logout
    Logs the current user off the system.
    ls
    List files

    lsList files in the current working directory except those starting with . and only show the file name.

    ls -alList all files in the current working directory in long listing format showing permissions, ownership, size, and time and date stamp
    more
    Allows file contents or piped output to be sent to the screen one page at a time.

    more /etc/profileLists the contents of the "/etc/profile" file to the screen one page at a time.

    ls -al |morePerforms a directory listing of all files and pipes the output of the listing through more. If the directory listing is longer than a page, it will be listed one page at a time.
    mv
    Move or rename files

    mv -i myfile yourfileMove the file from "myfile" to "yourfile". This effectively changes the name of "myfile" to "yourfile".

    mv -i /data/myfile .Move the file from "myfile" from the directory "/data" to the current working directory.
    pwd
    Show the name of the current working directory

    more /etc/profileLists the contents of the "/etc/profile" file to the screen one page at a time.
    shutdown
    Shuts the system down.

    shutdown -h nowShuts the system down to halt immediately.

    shutdown -r nowShuts the system down immediately and the system reboots.
    whereis
    Show where the binary, source and manual page files are for a command

    whereis lsLocates binaries and manual pages for the ls command.
    Editors: emacs, vi, pico, jed, vim

    Tuesday, September 29, 2015

    RDAC Driver RPM install



    RDAC Driver RPM


    0 people like this

    |Updated September 18, 2013 by JASON WO|Tags: None
    This rpm is a highly modified version of the release available from http://pkgs.org/centos-5-rhel-5/puias-computational-x86_64/kmod-rdac-09.03.0C05.0331-0.4.PU_IAS.5.x86_64.rpm.html which was designed for RHEL6. Modifications were made to port it RHEL5 to fit our environment and allow support for both RHEL5/RHEL6.
    The original rpm provides kmod rdac kernel modules compiled in a kernel agnostic manner against the stable ABI meaning as long as the ABI doesnt change from one kernel release to the next, then there is no need to recompile/rebuild the rpm.
    The rpm dependencies and actions have been modified to add missing files back in and have the rpm automatically perform post install configuration and automatically detect the installation of new kernels and perform reconfiguration as necessary without any manual intervention.
    DO NOT install this rpm on a box where you have previous manually compiled/installed the rdac drivers. The rpm must be installed on a box that hasn't yet had rdac drivers installed on it.
    1. When do the drivers/rpm need to be recompiled/upgraded?
    The rpms will need to be rebuilt any time there is a change in the kernel ABI (kABI) or when you want to upgrade to a new driver version. More information on how the kernel ABI is used can be gained by googling for "Redhat Driver Update Program" and you should find a few pdfs and driverupdateprogram.com as references.
    2. How do I check if a new kernel's ABI is supported by the current rdac kernel module rpms?
    This is done by validating the hashes of the ABI groups provided in the rpm to that of the kernel (note that this should be handled by rpm automatically but its a good pre kernel upgrade manual test to ensure they are compatible:
    # rpm --requires -qp kmod-rdac-09.03.0C05.0504-25.el5.x86_64.rpm | grep kernel
    kernel(rhel5_drivers_base_ga) = 61dc730b8ca5e74017f2df5b55ecda8b7df7f9c2
    kernel(rhel5_vmlinux_ga) = 78f928da689a93ecf2e044fc0ced6b3eaedf5c19
    kernel(rhel5_drivers_scsi_ga) = 1cc16b1f8996d37eaa858690bfbab7f4030c55b6
    kernel(rhel5_kernel_ga) = 84d69198cf51b494e38d9d0a54e52607c8a507e2
    kernel(rhel5_mm_ga) = d5edc1b3d2a4f2bf8ce28d7f4dbeab27cfeb19bd
    kernel(rhel5_lib_ga) = ff25b583d6d314edd98f7c9533c5867194b3d30d
    kernel(rhel5_fs_proc_ga) = 30f9166e128d20c7305d5a9bc9ab69451c40a555
    kernel(rhel5_block_ga) = 5b4effd1cc3809b4bd243e499ab6be486fd95fd9
    kernel(rhel5_fs_ga) = 1c422a6b84a2000991b1b99c61506cfd711a20d1
    kernel(rhel5_fs_u4) = 518e7b7963ed0843e4b55b64ba2b25db95cf821a
    kernel(rhel5_arch_x86_64_kernel_ga) = 880dbfce5086d666f5bab6ad642c0323fcdabd90
    kernel(rhel5_drivers_xen_core_ga) = c05a8027c47f037b99169c7441da64fa0a723869
    kernel(rhel5_kernel_module_ga) = a74a9d2bf87d13d6b9412698dc2728248ca92523
    # rpm --provides -q kernel-2.6.18-308.13.1.el5 | grep "kernel("
    kernel(rhel5_gfs2_ga) = 73e828ddf6a8787f935f6088a18a862409174aaf
    kernel(rhel5_fs_lockd_ga) = 67913a0875a3219e6b8c2d914775c91fab5b7c4f
    kernel(rhel5_drivers_hwmon_ga) = 21462092aeb2b284e955337136d204c26f79ed92
    kernel(rhel5_net_core_ga) = c186a7dc043c903564c2dd9ed49d8847b7043c86
    .... 
    # for modDep in $(rpm --requires -qp kmod-rdac-09.03.0C05.0504-25.el5.x86_64.rpm | grep kernel); do if ! /bin/grep "${modDep}" <<< "$(rpm --provides -q kernel-2.6.18-308.13.1.el5)" > /dev/null; then echo "ERROR: NOT FOUND ${modDep}"; fi done
    3. What steps do I need to perform before installing the rpms on a system which already has the rdac drivers installed manually from source?
      1. Unmount all partitions that are using the rdac driver (and comment them out in /etc/fstab if needed) and unmap all LUNs.
      2. Remove all MPP kernel boot entries from /boot/grub/grub.conf
      3. Remove all MPP init images:
         /bin/rm -f /boot/mpp-*.img
      4. Remove all lines from /etc/modprobe.conf and /etc/modprobe.conf.local that match the lines in /opt/mpp/modprobe.conf.mppappend
      5. Run the uninstall script:
         make -f /opt/mpp/makefile.saved uninstall
      6. Reboot the box
      7. Install the rdac rpms per normal instructions below.
      8. Re-enable any mount points and map any needed LUNs.
      9. Reboot the box
    4. What steps do I need to perform to rebuild the rpms?
      1. Get the source using git directly from the repo, or manually browse to the git server and download the tar.gz for the most recent date listed:
         git clone http://10.19.10.164/wdprepos/pub/UnixTools/Linux/rdac-kmod.git
         cd rdac-kmod
         or
         Browse to http://10.19.10.164/gitweb/?p=pub/UnixTools/Linux/rdac-kmod.git;a=summary and click the topmost "tar.gz" to download the latest version and extract it on the build server.
       2. Ensure you have gcc, make, buildsys-macros and rpm-build rpms installed:
          yum --noplugins --disablerepo=* --enablerepo=R* install gcc make buildsys-macros rpm-build
       3. Run the following as a regular user:
          ./rdac-kmod-rpmbuild.sh
       4. Stage the rpms in ~/rpmbuild/RPMS// in the tools repo (do not stage the debug rpm) and reindex the tools repo:
          See instructions for staging rpms at https://w3.tap.ibm.com/w3ki/display/wdpdo/Staging%20RPMs%20to%20ITE%20Tools%20Repository
       5. Use the normal yum install or upgrade command to install (see step 5 below).
    5. What steps do I need to perform to install the rpms?
    yum --disablerepo=* --enablerepo=WDP-Tools* install kmod-rdac rdac
    6. Will the current rdac-kmod.spec file work for new versions of the rdac driver?
    There's no way to know before hand whether the existing spec file will work for future versions of the rdac driver without modification as this is 100% dependent on what changes are made to the make file for the new release. You will have to review changes that are made to the copyfiles, copyrpmfiles, moduledep, setupfiles, setupdriver, uninstall, and uninstall_doer sections and ensure the same steps are done in the proper sections of the spec file but only if necessary.
    7. I have installed the rdac rpms and will be doing a kernel upgrade, what steps do I need to perform?
    If you have done the pre-upgrade check in step 2 and no errors are reported, then just upgrade the kernel as normal and there are no extra steps, the rpm should handle the rest.