Instructor: Professor Hong
man
- shows you the man(ual) page of the command
cd directory
-- change directorycd ..
mkdir directory
-- make directorypwd
-- tells you where you currently aretouch filename
-- creates a blank file or updates the timestamp of the file touchedls
- list directoriesls -l
-- lists your files in a long formatls -a
-- lists all files including those that begin with a dotls -latrh
-- lists all files in long format, in reverse order of the modification time, in human-readable form (use man
to read moremv filename1 filename2
-- moves a file; also renames a filecp filename1 filename2
-- copies a filerm filename
-- removes a filerm -rf *
-- removes everything!! Make sure you back things up; we will do that later with Github
*
is a wildcarddiff filename1 filename2
-- diffs 2 fileswc filename
-- tells you how many lines, words, and characters are in a filechmod options filename
-- changes the read, write, and executable access for a filechmod 777 filename
to enable all access for all types of users
ff
-- find files anywhere on the systemgrep string filename
-- looks for a string in the files in the directoryman grep
Note: Depending on the company you end up working for, you may not be able to install certain editors/IDE. You should learn one of the basics - vim or emacs.
vim filename
-- to start editing a file with vimESC :w
-- write/save the fileESC i
-- insert before the characterESC a
-- insert after the characterESC :q
-- quit vim#!/bin/bash
mkdir new_folder
cd new_folder
touch new_file.txt
ls
$ chmod 777 unix_commands.sh
$ ./unix_commands.sh
You should see a directory created with a blank file.
Start by writing hello.c:
$ vim hello.c
#include <stdio.h>
int main()
{
printf("Hello, World!\n");
return 0;
}
$ gcc hello.c
$ ./a.out
The result should print:
Hello, World!
Setting up your github user name and email:
$ git config --global user.name "Your Name"
$ git config --global user.email "yourEmail@cooper.edu"
Set up your ssh key:
$ ssh-keygen -C "me@cooper.edu" -t rsa
$ cat .ssh/id_rsa.pub
Copy the key and put it in your account settings.
More info can be found here: https://help.github.com/articles/connecting-to-github-with-ssh/
$ git clone git@github.com:yourUserName/repoName.git
$ git checkout -b helloBranch
$ git add hello.c
$ git commit -m "first commit"
$ git push origin helloBranch
$ git clone <link>
$ cd question1
$ vim q1.sh
$ git push origin main
Check https://hong3cooper.github.io/ for your section's HW link. due 09/14/23 @ 11:59PM