Sei sulla pagina 1di 44

Mac OS X is based on UNIX "terminal window" is your friend

gives you "command line" power Linux/Unix command rule

SSH Secure Shell


Client
File Transfer Client

download and install http://www.itd.umich.edu/bluedisc/


pick operating system SSH Secure Shell 3.2.9 (Dec. 2009) Info Download 11.7

MB

Quick Connect

Host Name: login.itd.umich.edu User Name: uniqname Connect Password: type Kerboros passwd

ls

list files in current directory dir in DOS on PC

ls pwd

list files in current directory present working directory

cd Private change directory to "Private" mkdir EECS183 make directory "EECS183" note: linux does NOT like spaces in filenames ls -alg list All files long format

ls pwd cd xxxx

list files in current directory present working directory change directory to xxxx Example: cd Private make directory "EECS183"

mkdir EECS183

note: linux does NOT like spaces in filenames


ls -alg list All files long format

ls pwd cd xxxx

list files in current directory present working directory change directory to xxxx

mkdir xxxx make directory xxxx

note: linux does NOT like spaces ls -alg list All files long format

ls pwd cd Private

list files in current directory present working directory change directory to "Private" make directory "EECS183"

mkdir EECS183

note: linux does NOT like spaces ls -al list All files long format

% ls -l total 476
-rwxr-xr-x drwxr-xr-x drwxr-xr-x drwxrwxrwx -rw-r--r-1 3 2 3 1 mdorf mdorf mdorf mdorf mdorf staff 455203 Nov 19 staff 2048 Jan 21 staff 2048 Oct 29 staff 2048 Nov 6 staff 455203 Nov 19 2011 2004 2009 2010 2011 a.out f02_proj1 proj4 test towers.exe

% ls -l total 476
-rwxr-xr-x drwxr-xr-x drwxr-xr-x drwxrwxrwx -rw-r--r-1 3 2 3 1 mdorf mdorf mdorf mdorf mdorf staff 455203 Nov 19 staff 2048 Jan 21 staff 2048 Oct 29 staff 2048 Nov 6 staff 455203 Nov 19 2011 2004 2009 2010 2011 a.out f02_proj1 proj4 test towers.exe

d s l

normal file directory socket file link file

% ls -l total 476
-rwxr-xr-x drwxr-xr-x drwxr-xr-x drwxrwxrwx -rw-r--r-1 3 2 3 1 mdorf mdorf mdorf mdorf mdorf staff 455203 Nov 19 staff 2048 Jan 21 staff 2048 Oct 29 staff 2048 Nov 6 staff 455203 Nov 19 2011 2004 2009 2010 2011 a.out f02_proj1 proj4 test towers.exe

Next 9 characters read/write/execution permissions for user, group, world


(more later)

% ls -l total 476
-rwxr-xr-x drwxr-xr-x drwxr-xr-x drwxrwxrwx -rw-r--r-1 3 2 3 1 mdorf mdorf mdorf mdorf mdorf staff 455203 Nov 19 staff 2048 Jan 21 staff 2048 Oct 29 staff 2048 Nov 6 staff 455203 Nov 19 2011 2004 2009 2010 2011 a.out f02_proj1 proj4 test towers.exe

number of links for that file

% ls -l total 476
-rwxr-xr-x drwxr-xr-x drwxr-xr-x drwxrwxrwx -rw-r--r-1 3 2 3 1 mdorf mdorf mdorf mdorf mdorf staff 455203 Nov 19 staff 2048 Jan 21 staff 2048 Oct 29 staff 2048 Nov 6 staff 455203 Nov 19 2011 2004 2009 2010 2011 a.out f02_proj1 proj4 test towers.exe

% ls -l total 476
-rwxr-xr-x drwxr-xr-x drwxr-xr-x drwxrwxrwx -rw-r--r-1 3 2 3 1 mdorf mdorf mdorf mdorf mdorf staff 455203 Nov 19 staff 2048 Jan 21 staff 2048 Oct 29 staff 2048 Nov 6 staff 455203 Nov 19 2011 2004 2009 2010 2011 a.out f02_proj1 proj4 test towers.exe

% ls -l total 476
-rwxr-xr-x drwxr-xr-x drwxr-xr-x drwxrwxrwx -rw-r--r-1 3 2 3 1 mdorf mdorf mdorf mdorf mdorf staff 455203 Nov 19 staff 2048 Jan 21 staff 2048 Oct 29 staff 2048 Nov 6 staff 455203 Nov 19 2011 2004 2009 2010 2011 a.out f02_proj1 proj4 test towers.exe

% ls -l total 476
-rwxr-xr-x drwxr-xr-x drwxr-xr-x drwxrwxrwx -rw-r--r-1 3 2 3 1 mdorf mdorf mdorf mdorf mdorf staff 455203 Nov 19 staff 2048 Jan 21 staff 2048 Oct 29 staff 2048 Nov 6 staff 455203 Nov 19 2011 2004 2009 2010 2011 a.out f02_proj1 proj4 test towers.exe

% ls -l total 476
-rwxr-xr-x drwxr-xr-x drwxr-xr-x drwxrwxrwx -rw-r--r-1 3 2 3 1 mdorf mdorf mdorf mdorf mdorf staff 455203 Nov 19 staff 2048 Jan 21 staff 2048 Oct 29 staff 2048 Nov 6 staff 455203 Nov 19 2011 2004 2009 2010 2011 a.out f02_proj1 proj4 test towers.exe

d: r: w: x:

directory read write execute

d: r: w: x:

directory read write execute

in group of 3 owner group


2048 Oct 29

others
2002 proj4

drwxr-xr-x 2 mdorf staff directory rwx for 'owner' r-x for 'group' r-x for 'others'

d: r: w: x:

directory read write execute

in group of 3 owner group

others
2011 towers.exe

-rw-r--r-- 1 mdorf staff 455203 Nov 19

owner rw-

group r--

others r--

d: r: w: x:

directory read write execute

in group of 3 owner group

others
2011 towers.exe

-rw-r--r-- 1 mdorf staff 455203 Nov 19

owner rw-

group r--

others r--

NO ONE can execute

-rw-r--r-- 1 mdorf staff 455203 Nov 19 owner group other "who" are permissions being changed for u user who owns the file g group the file belongs to o other users a all of the above

2011 towers.exe

add 'execute' 1) chmod u+x 2) chmod g+x chmod o+x 3) chmod a+x

towers.exe towers.exe towers.exe towers.exe

-rw-r--r-- 1 mdorf staff 455203 Nov 19 owner group other "who" are permissions being changed for u user who owns the file g group the file belongs to o other users a all of the above

2011 towers.exe

add 'execute' 1) chmod u+x 2) chmod g+x chmod o+x 3) chmod a+x

towers.exe towers.exe towers.exe towers.exe

cp

from

to test1.cpp

cp v.cpp

rm

fileName

rm rm

fileName proj5.* //dangerous

rm rm

fileName proj5.* //dangerous

rm

*.*

//DANGEROUS

rm rm

fileName proj5.* //dangerous

rm
rm

*.*
*

//DANGEROUS
//REALLY DANGEROUS

rmdir

name name // DANGEROUS

rmdir rf

use arrow keys to go through previous commands easy way to type it once and run it often

g++ debug.cpp

g++ -c Point.cpp g++ -c Line.cpp

Compile every *.cpp in current directory and create executable g++ *.cpp

Compile every *.cpp in current directory and create executable g++ *.cpp

./a.out

run the executable

g++ fileName.cpp o exeName

./exeName

run the executable

./a.out < data1.txt

acts as though input is coming from keyboard

./a.out > runOut.txt

puts all output to the file

./a.out < input.txt > runOut.txt

reads from keyboard and outputs to the file

diff

file1.txt

file2.txt

will give all differences

vim emacs

Gedit
nano

cheat sheets:
http://www.tuxfiles.org/linuxhelp/vimcheat.html
http://bullium.com/support/vim.html

develop in Visual and upload to a linux system to make sure it works


upload is easy using SSH file transfer (blue disk)

use redirection and different input files diff output with expected output

If any faculty and/or GSI/IA in 280 tells you that you MUST develop in linux, please please relay this to me this is NOT true, nor needed take the easy way and use an IDE
Visual xcode double check in linux

Potrebbero piacerti anche