Ad

Sunday, March 6, 2016

CodeTV ScreenCast Unix Basics Linux Shell Commands Fundamental Tutorial Course Notes and Review

Agenda: files, directories, paths, permissions
Environment: Mac OS, Linux, Unix
Rating: 5 stars


  • - Files agenda: 1. creating files, 2. listing files, 3. alerting files 4. links
  • - Can practice in Mac OS terminal and finder file directory
  • - $ls
  • - Above command list files
  • - $cp replicator.txt tribble.txt
  • - Above command cp copies files
  • - $mv transporter.txt bridge.txt
  • - The above command effectively RENAME the first file to second file name
  • - $rm file_name.txt
  • - Rm remove one or more files
  • - $echo
  • - Print something in the terminal
  • - $echo "starship" > wormhole.txt
  • - The above command puts "starship" text into a file, effectively create a new file
  • - $cat file_name.txt
  • - Cat command prints text in a file
  • - $ln wormhole.txt gamma.txt
  • - ln is a link command, cat a linked file will show identical result, however, overriding the original file will also override the linked file. Each file refers to a storage in Unix called inode or index node.
  • - $ls -i
  • - will show all the inode number of each file
  • - Linked file will have the same inode number. It's not the same copy of file, but actually referring to the same content.
  • - ln -s wormhole.txt gamma.txt
  • - The symbolic link is a also known as a soft link by passing the -s option to ln. It works a bit differently. Soft linked files have different inode numbers. Symbolic link refers to the file name not the actual content, especially useful for linking across different storage devices such as a USB drive. The inode number has to differ because they are entirely different file systems. Trying to hard link two files across two file systems will result an error but symbolic link will be successful.
  • - Can always use the man command to read about unix commands
  • - Instruction agenda (directories): 01 displaying a directory path, 02 creating directories, 03 switching into a directory, 04 current and parent directories, 05 linking directories
  • - command: pwd
  • - pwd is short for print working directory. Displays the the current folder path. 
  • - command: mkdir <folder_name>
  • - mkdir makes a new folder with a specified name
  • - command: cd <directory_name>
  • - cd command stands for change directory. Change current directory to the specified directory. 
  • - command: cd ..
  • - cd .. changes directory, and specifically changes to the current directory's PARENT DIRECTORY
  • - command: ls -a
  • - use ls -a to list all directories including hidden directory and the parent directory
  • - use ls -a -i to list all directories and files in the current directory with their i nodes
  • - command: cp ../childdir/myfile.txt .
  • - The above command looks for the parent directory of the current directory, and find a child directory called childdir, find its file called myfile.txt and copy it into the current directory, respresented by a dot. The dot symbol refers to the current directory. 
  • - command: cp -r <directory_name>
  • - cp -r copies recursively what's in the directory. cp <directory_name> with the -r option isn't enough. 
  • - rm -r <directory_name> deletes a directory. Can't work without the -r option.
  • - Concept: linking two directories. Cannot make a hard link, can only make a symbolic link between two directory. Pass in -s option for symbolic link.
  • - command: ln -s <dir_1_name> <dir_2_name>
  • End of notes and summary for Unix Basics Part 1 by Code School

1 comment:

K mean clustering sklearn best practice - Udacity Machine Learning Nanodegree Unsupervised Learning

There are three key k means clustering parameters in sklearn that you will need to pay attention to: Number of centroids, aka center of c...