Intro to NIX

download Intro to NIX

of 16

Transcript of Intro to NIX

  • 7/27/2019 Intro to NIX

    1/16

    High Performance Computing @ Louisiana State University - http://www.hpc.lsu.edu/High Performance Computing @ Louisiana State University - http://www.hpc.lsu.edu/

    Information Technology Services

    LONI High Performance Computing WorkshopLONI High Performance Computing Workshop

    Intro to Linux/AIX

  • 7/27/2019 Intro to NIX

    2/16

    High Performance Computing @ Louisiana State University - http://www.hpc.lsu.edu/High Performance Computing @ Louisiana State University - http://www.hpc.lsu.edu/

    Information Technology Services

    LONI High Performance Computing WorkshopLONI High Performance Computing Workshop

    *NIX: The Joy of Typing

    No menus, no start button, no pop up

    windows, not much use for a mouse, etc.

    Many operating system variations:

    AIX, Red Hat Linux, BSD, System V, etc.

    Shell variations: sh, bash, csh, etc.

  • 7/27/2019 Intro to NIX

    3/16

    High Performance Computing @ Louisiana State University - http://www.hpc.lsu.edu/High Performance Computing @ Louisiana State University - http://www.hpc.lsu.edu/

    Information Technology Services

    LONI High Performance Computing WorkshopLONI High Performance Computing Workshop

    Logging In

    From a Linux command line:

    ssh [email protected]

    Use "putty" (or something similar) on

    Windows

    LONI Network .lsu.edu

    .latech.edu

    .ull.edu

    mailto:[email protected]:[email protected]
  • 7/27/2019 Intro to NIX

    4/16

    High Performance Computing @ Louisiana State University - http://www.hpc.lsu.edu/High Performance Computing @ Louisiana State University - http://www.hpc.lsu.edu/

    Information Technology Services

    LONI High Performance Computing WorkshopLONI High Performance Computing Workshop

    Basic Commands

    ls list files echo print something

    rm remove files

    mv move files

    cp copy files

    cd change working directory pwd print working directory

    man show man page

  • 7/27/2019 Intro to NIX

    5/16

    High Performance Computing @ Louisiana State University - http://www.hpc.lsu.edu/High Performance Computing @ Louisiana State University - http://www.hpc.lsu.edu/

    Information Technology Services

    LONI High Performance Computing WorkshopLONI High Performance Computing Workshop

    Life on the Command Line

    sbrandt@l2f1n01$ ls -F

    a/ boost_1_34_1@ hist* rep.pl scratch@

    admconst.tar c/ ma/ rep.sh* src@

    admin/ check.pl mymalloc.tgz rep.tar test/archives@ cjobs* populate.pl* rep_gen* ww

    sbrandt@l2f1n01$ pwd

    /home/sbrandt

    sbrandt@l2f1n01$ cd test

    sbrandt@l2f1n01$ ls -F

    Bench_BSSN_PUGH_80l.par computePi.C pi.out

    b.ll coredir.4/ x.ll

    computePi* pi.err

    sbrandt@l2f1n01$

  • 7/27/2019 Intro to NIX

    6/16

    High Performance Computing @ Louisiana State University - http://www.hpc.lsu.edu/High Performance Computing @ Louisiana State University - http://www.hpc.lsu.edu/

    Information Technology Services

    LONI High Performance Computing WorkshopLONI High Performance Computing Workshop

    Listing Files: ls ls -F

    Shows a special character at the end of the file

    indicating what it's type is. / means directory, *

    means program.

    ls -l

    Long listing: Shows permissions, ownership,

    modification time, and size in bytes.

    ls -a Shows hidden files, i.e. files beginning with .

    ls -d

    Does not list the contents of a directory, but tellsou about the director itself.

  • 7/27/2019 Intro to NIX

    7/16

    High Performance Computing @ Louisiana State University - http://www.hpc.lsu.edu/High Performance Computing @ Louisiana State University - http://www.hpc.lsu.edu/

    Information Technology Services

    LONI High Performance Computing WorkshopLONI High Performance Computing Workshop

    Where am I?

    pwd

    Tells you where you are in the file system.

    cd /home/sbrandt

    Takes me to my home directory (where my

    files are, the ones I can see and modify).Starts with a /, that makes it an "absolute

    path."

    cd

  • 7/27/2019 Intro to NIX

    8/16

    High Performance Computing @ Louisiana State University - http://www.hpc.lsu.edu/High Performance Computing @ Louisiana State University - http://www.hpc.lsu.edu/

    Information Technology Services

    LONI High Performance Computing WorkshopLONI High Performance Computing Workshop

    Where am I? part 2

    cd .

    Does nothing. Takes me to the current dir.

    cd ..

    Takes me one level up. If I was in

    /home/sbrandt, "cd .." takes me to /home. cd test

    This is a "relative" path. Takes me to a

    directory called "test" if one exists from the

  • 7/27/2019 Intro to NIX

    9/16

    High Performance Computing @ Louisiana State University - http://www.hpc.lsu.edu/High Performance Computing @ Louisiana State University - http://www.hpc.lsu.edu/

    Information Technology Services

    LONI High Performance Computing WorkshopLONI High Performance Computing Workshop

    Getting Help

    ls --help

    Many commands will provide usage

    instructions if given this option

    man ls

    Show a man page for the command. Fromthis you can learn about other machine

    specific options: -h for human readable. Not

    on AIX.

  • 7/27/2019 Intro to NIX

    10/16

    High Performance Computing @ Louisiana State University - http://www.hpc.lsu.edu/High Performance Computing @ Louisiana State University - http://www.hpc.lsu.edu/

    Information Technology Services

    LONI High Performance Computing WorkshopLONI High Performance Computing Workshop

    Fun things to try with "echo" echo hello world

    Just print the words "hello world"

    echo $0

    Tell us what shell we are using

    echo $PATH

    Tell us where commands can be found

    echo $HOME

    Where is our home directory

    echo hello > h.txt

    Creates a file named "h.txt" containing "hello"

  • 7/27/2019 Intro to NIX

    11/16

    High Performance Computing @ Louisiana State University - http://www.hpc.lsu.edu/High Performance Computing @ Louisiana State University - http://www.hpc.lsu.edu/

    Information Technology Services

    LONI High Performance Computing WorkshopLONI High Performance Computing Workshop

    Copying files

    cp file1 file2

    Creates file2, it is identical to file1

    cp file1 f/

    Copies file1 to the directory f

    cp file1 file2 f/Copies file1 and file2 to the directory f

    cp file* f/

    Co ies all files that start with "file" to f

  • 7/27/2019 Intro to NIX

    12/16

    High Performance Computing @ Louisiana State University - http://www.hpc.lsu.edu/High Performance Computing @ Louisiana State University - http://www.hpc.lsu.edu/

    Information Technology Services

    LONI High Performance Computing WorkshopLONI High Performance Computing Workshop

    Moving files

    mv file1 file2

    Renames file1 to file2

    mv file1 f/

    Moves file1 to the directory f

    mv file1 file2 f/Moves file1 and file2 to the directory f

    cp file* f/

    Moves all files that start with "file" to f

    h f h h l d

  • 7/27/2019 Intro to NIX

    13/16

    High Performance Computing @ Louisiana State University - http://www.hpc.lsu.edu/High Performance Computing @ Louisiana State University - http://www.hpc.lsu.edu/

    Information Technology Services

    LONI High Performance Computing WorkshopLONI High Performance Computing Workshop

    Removing files!

    Warning! Caution! Danger!

    rm -f

    Forcibly remove files

    rm -i

    Interactively remove files, prompts for eachremoval

    rm -r

    Recursively remove files, including dirs

    h f C @ S h h l dHi h P f C i @ L i i S U i i h // h l d /

  • 7/27/2019 Intro to NIX

    14/16

    High Performance Computing @ Louisiana State University - http://www.hpc.lsu.edu/High Performance Computing @ Louisiana State University - http://www.hpc.lsu.edu/

    Information Technology Services

    LONI High Performance Computing WorkshopLONI High Performance Computing Workshop

    Organizing using mkdirsbrandt@l2f1n01$ ls

    Bench_BSSN_PUGH_80l.par file1

    b.ll file2

    computePi file3

    computePi.C pi.err

    coredir.4 pi.out

    f x.ll

    sbrandt@l2f1n01$ mkdir ll_files

    sbrandt@l2f1n01$ mv *.ll ll_files/

    sbrandt@l2f1n01$ ls ll_files

    b.ll x.ll

    sbrandt@l2f1n01$

    Hi h P f C i @ L i i S U i i h // h l d /Hi h P f C ti @ L i i St t U i it htt // h l d /

  • 7/27/2019 Intro to NIX

    15/16

    High Performance Computing @ Louisiana State University - http://www.hpc.lsu.edu/High Performance Computing @ Louisiana State University - http://www.hpc.lsu.edu/

    Information Technology Services

    LONI High Performance Computing WorkshopLONI High Performance Computing Workshop

    The Visual Editor: VI

    Sorry, that's the next presentation.

    Hi h P f C ti @ L i i St t U i it htt // h l d /Hi h P f C ti @ L i i St t U i it htt // h l d /

  • 7/27/2019 Intro to NIX

    16/16

    High Performance Computing @ Louisiana State University - http://www.hpc.lsu.edu/High Performance Computing @ Louisiana State University - http://www.hpc.lsu.edu/

    Information Technology Services

    LONI Hi h P f C ti W k hLONI High Performance Comp ting Workshop

    Other things to learn

    Chaining commands together with pipes:

    the symbol "|"

    Basically useful commands: grep, find,

    xargs, sed, and less

    Working with Processes: ps, top, kill,nohup and the symbol "&"

    Changing ownership and permission of

    files: chown, chgrp, chmod