Download presentation
Presentation is loading. Please wait.
Published bySophie Marshall Modified over 8 years ago
1
– 1 – CSCE 211H Fall 2015 Lecture 5 Linux Basics Topics Linux 10 essential commands Machine names forReadings September 21, 2015 CSCE 211 Digital Design
2
– 2 – CSCE 211H Fall 2015 10 essential Linux commands ls cd cp mv mkdir rm less nano find/sudo http://www.dummies.com/how-to/content/10-essential- linux-commands-for-your-raspberry-pi.html
3
– 3 – CSCE 211H Fall 2015 Nano – basic editor GNU nano 2.2.6 File: bitwise.c GNU nano 2.2.6 File: bitwise.c #include "stdio.h" main(){ int i, x, y, z; int i, x, y, z; unsigned int ux, uy, uz; unsigned int ux, uy, uz; x = 0x01020305; x = 0x01020305; i=2; i=2; y = x << i; y = x << i; printf("int=%d is represented by 0x%08x\n", x, x); printf("int=%d is represented by 0x%08x\n", x, x); printf("x=0x%08x shifted left by %d is represented by y=0x%08x\n", x, i, y); printf("x=0x%08x shifted left by %d is represented by y=0x%08x\n", x, i, y); printf("x&y=0x%08x \n", x&y); printf("x&y=0x%08x \n", x&y); printf("x|y=0x%08x \n", x|y); printf("x|y=0x%08x \n", x|y); printf("x^y=0x%08x \n", x^y); printf("x^y=0x%08x \n", x^y); printf("~x=0x%08x \n", ~x); printf("~x=0x%08x \n", ~x);} [ Read 20 lines ] [ Read 20 lines ] ^G Get Help ^O WriteOut ^R Read File ^Y Prev Page ^K Cut Text ^C Cur Pos ^X Exit ^J Justify ^W Where Is ^V Next Page ^U UnCut Text^T To Spell
4
– 4 – CSCE 211H Fall 2015 Other essentials Login Logout Save files from mail Compile and run code nano prog.c//edit gcc prog.c// compile ./a.out v1 v2// run program with arguments v1, v2 ifconfig – find ipaddress of machine Putty – remote login to machines Ssh remote login from another unix machine
5
– 5 – CSCE 211H Fall 2015 Compile and run programs nano prog.c//edit gcc prog.c// compile ./a.out v1 v2// run program with arguments v1, v2
6
– 6 – CSCE 211H Fall 2015 l-1d39-07> more bool1.c #include "stdio.h" main(){ int x, y, z; int x, y, z; int t1, t2, t3, t4,t5; int t1, t2, t3, t4,t5; printf("Truth table for XOR\n\n"); printf("Truth table for XOR\n\n"); printf("x y | x xor y \n"); printf("x y | x xor y \n"); printf("______________\n"); printf("______________\n"); for(x=0; x <=1; ++x){ for(x=0; x <=1; ++x){ for(y=0; y <=1; ++y){ for(y=0; y <=1; ++y){ t1 = x && !y || !x && y; t1 = x && !y || !x && y; printf("%d %d | \t%d\n", x, y, t1); printf("%d %d | \t%d\n", x, y, t1); } }}
7
– 7 – CSCE 211H Fall 2015 Proof by Perfect Induction (All cases in Table) #include "stdio.h" main(){ int x, y, z; int x, y, z; int t1, t2, t3, t4,t5; int t1, t2, t3, t4,t5; printf("Truth table for Demorgan's Law (x&y)' = x' + y' \n\n"); printf("Truth table for Demorgan's Law (x&y)' = x' + y' \n\n"); printf("x y | x&y !(x&y) || !x !y !x || !y\n"); printf("x y | x&y !(x&y) || !x !y !x || !y\n"); printf("___________________________________\n"); printf("___________________________________\n"); for(x=0; x <=1; ++x){ for(x=0; x <=1; ++x){ for(y=0; y <=1; ++y){ for(y=0; y <=1; ++y){ t1 = x && y; t1 = x && y; t2 = !t1; t2 = !t1; t3 = !x; t3 = !x; t4 = !y; t4 = !y; t5 = t3 || t4; t5 = t3 || t4; printf("%d %d | %d %d || %d %d %d\n", printf("%d %d | %d %d || %d %d %d\n", x, y, t1, t2, t3, t4, t5); x, y, t1, t2, t3, t4, t5);
8
– 8 – CSCE 211H Fall 2015 Boolean table with 3 variables #include "stdio.h" main(){ int x, y, z; int x, y, z; int t1, t2, t3, t4,t5; int t1, t2, t3, t4,t5; printf("x y z | f\n"); printf("x y z | f\n"); printf("---------\n"); printf("---------\n"); for(x=0; x <=1; ++x){ for(x=0; x <=1; ++x){ for(y=0; y <=1; ++y){ for(y=0; y <=1; ++y){ for(z=0; z <=1; ++z){ for(z=0; z <=1; ++z){ t1 = !x && y &&!z; t1 = !x && y &&!z; printf("%d %d %d | %d\n", x, y, z, t1); printf("%d %d %d | %d\n", x, y, z, t1); } } }}
9
– 9 – CSCE 211H Fall 2015 Machine names L-1D39-07.cse.sc.edu Ifconfig to find ip address Then putty machine-name or putty ip-address to remote login
10
– 10 – CSCE 211H Fall 2015
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.