100 likes | 116 Views
Lab 00 Discussion Linux Basics. CSCE 212 Computer Architecture. Topics Login in SWGN 1D39, a Linux Lab (3D22 is another) Code-all.tgz (all the code from the book) Basic Unix Commands. January 16, 2018. Overview. Last Time Lec00 – C primer slides (we did not go over these in class) New –
E N D
Lab 00 DiscussionLinux Basics CSCE 212 Computer Architecture Topics • Login in SWGN 1D39, a Linux Lab (3D22 is another) • Code-all.tgz (all the code from the book) • Basic Unix Commands January 16, 2018
Overview Last Time • Lec00 – C primer slides (we did not go over these in class) New – • Login • Filesystem “tree” • Basic Commands • Saving attachment from email “code-all.tgz” • Unpacking • Compiling showbytes • Running Next Time:
Login to Unix/Linux Boxes in 1D39 • Your Login name is the root_name of your USC email address • Your password is your email password • To logout you … (I’ll check on this. On my Linux box it is done differently and I’ll have to go down to 1D39 to remember how you do it there.
Unix file system / • At every point in Unix you are “in” the current working directory • At login your “current directory” initially will be your home-dir • You specify files and directories with paths • A full path (starts with slash) /acct/matthews/212 • A relative path does not start with ‘/’ and starts from the current directory acct bin dev … proc etc matthews … ls cp device drivers 212
Basic Commands • ls – list the contents of this directory • cd – change directory • pwd – print working (current) directory • mkdir – make a directory • cp – copy file • mv – move a file (= rename) • rm – remove a file • pico (maybe nano) – a simple editor • gcc (Gnu C Compiler) – • man cmd – print the manual page on cmd
30 Useful Unix Commands • From Univ. of Manchester 1997 • http://www.maths.manchester.ac.uk/~pjohnson/resources/unixShort/examples-commands.pdf
More Unix references • 50 Most Frequently Used UNIX / Linux Commands (With Examples) • 2010 Ramesh Natarajan • More experienced selection of commands • http://www.thegeekstuff.com/2010/11/50-linux-commands/?utm_source=feedburner • 100 Useful Unix Commands & Unix Intro. • 2014 by Oliver • http://www.oliverelliott.org/article/computing/ref_unix/ • http://www.oliverelliott.org/article/computing/tut_unix/
Saving and unpacking code-all.tgz • mkdir 212 • Student webmail • Save attachment • cd // go home • cd Downloads • cp code-all.tgz ~/212 • cd ~/212 • ls • tar xvfz code-all.tgz
Compiling showbytes • Cd code • Cd data • gccshow_bytes.c // this produces a.out • ./a.out // run the executable • gccshow_bytes.c –o prog// names the executable prog • ./prog // run the executable • Note show_bytes.c might be show-bytes.c