Skip to content

Instantly share code, notes, and snippets.

@ataki
Last active March 4, 2017 15:57
Show Gist options
  • Save ataki/8344263 to your computer and use it in GitHub Desktop.
Save ataki/8344263 to your computer and use it in GitHub Desktop.
107 Unix Lab
Basic Command Format
--------------------------
$ ~> <cmd>
$ ~> <cmd> <arg>
$ ~> <cmd> -<flag>
Moving around
---------------------------
$ ~> cd <directory>
$ ~> ls
$ ~> pwd
Paths
----------------------------
Relative
$ ~> cd <folder1>/<folder2>/...
Absolute
$ ~> cd /afs/ir/class/cs107/<folder1>/.../
Edit Text
----------------------------
$ ~> vim
Basic vim commands:
"Save": "Esc + :w"
"Quit": "Esc + :q"
"Move left": "h"
"Move right": "l"
"Move up": "k"
"Move down": "j"
To go into insert mode:
"Insert Mode": "i"
SSH
-----------------------------
Log in from anywhere (home, China, etc...)
My SUNETID (email addr minus @stanford) is "ataki":
$ ~> ssh ataki@myth.stanford.edu
Mercurial
-----------------------------
FIRST
Set up your HG text editor.
$ ~> vi ~/.hgrc
Follow instructions here:
https://courseware.stanford.edu/pg/pages/view/371919/cs107-guide-to-mercurial
"Clone repo"
$ ~> hg clone </path/to/...>
"Save editing changes"
$ ~> hg commit
"See history of your commits"
$ ~> hg log
Putting it all together:
----------------------------
1. Use Mercurial to clone your assignment 0 repo.
You will need an absolute path. The path is:
/afs/ir/class/cs107/repos/assign0/<your_username>/
2. Open the custom_txt file. Follow the instructions on the command assignments
If we have time
---------------------------
Making an executable
vi exercise.c
** Do some editing **
gcc -g -std=gnu99 -Wall --pedantic -m32 -o exercise exercise.c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment