Tuesday, December 11, 2012

codejournal

compiling binaries in the UNIX environment with gcc compiler... from the *nix command line! woot.

vim commands
:q quit, save
:w save
:q! quit without saving

i : insert mode
esc : command mode
h, j, k, l : movement in command mode
w, e : skip to the beginning/end of next word
f, n : find next instance of the word, goto Next instance
A : move to end of line and insert mode (A = append?)
$ : move to end of line
gg, G : move to beginning/end of the file

-i just realized i ought to write my blogposts in vim from now on....



UNIX terminal stuff
permission groups, directory bits
the command I should never ever use: "rm -rf /" aka "recursively remove everything from the contents of root"

./executable : execute file in the current directory?
rm - remove file
mkdir - make directory
cp file file2 - make copy of file to file2name
ls -la - list directory -l = long (permissions), -a = all
touch <filename.ext> : create file
vim <filename optional> : enter vim, edit file or create file
cat : output contents of file
| : (pipes) -> redirect stdout of one program to stdin or another prog1 stdout | prog2 stdin
chmod (a+x) : change permissions... ??
chown : change owners
sudo : "superuser do" -> execute program with root authority [not safe]

gcc complier stuff
makefiles
    all:
    clean:
etc
makefiles are utility scripts that are used by gcc to compile / clean your binaries in a specified way
gcc looks for these files (in order): GNUMakefile, Makefile, makefile
can call with a certain  makefile in mind, e.g., makefile -f MyMakeFile <file to make>


No comments:

Post a Comment

Let me know what you think!