Linux and C

LogN

More people working on a problem means more room for error

Milk example for hierarchy and creating “infinity”


Linux

Data: Files and paths

Two types ~

  • Directory: A file that contains other files

  • File: A normal file


The root: /


pwd: Print Working Directory - tells you where you are in the path (file explorer)

ls: List - lists out files / directories beneath where you are currently at

ls -l : Give me the files in a table / with more info - Gives when it was created, the size, who owns it

  • If it is preceded with a d, that means it is a directory


cd (directory name): brings you to the desired directory

cd .. : Brings you to your parent directory

. : single dot is the location where I am currently


cd ./(directory name) : Bring me to the desired directory underneath my current position


Can put in . or .. in directory name place


d rwx rwx rwx

me

group

world


Tells whether or not certain parties can read, write, or execute this file


110 011 001

6 3 1


chmod 644 (file name) - makes it to where I can read and write but everyone else can only read


cd /Users/pdjoshi/cs429/test - absolute path starting from the root (must always start from the root)

Other paths are relative paths (Relative to your starting point)


cd ./ test is the same as cd test because the ./ is implicit (there are certain circumstances where you must specify)


whoami - tells you what file you are at


who - tells you which users are logged into this machine


this is because there may be multiple machines that have access to a single data center

And then multiple can log onto any of these machines and access data from that data center (they will only be able to see data their account has access to)


la -a : shows you all files including hidden files

Hidden files are characterized by the . being the first character in their name


rm - removes a file

rm dir - removes directory

alias rm=’rm -i

alias is a shortcut created only for your use

Does not restart when your restart the terminal


unalias rm

rm junk

touch junk


man ls - gives you a manual on all the different things you can use with ls


history - will give you past commands you have written