MAD 9112 - serdarulutas/MADD-Notes Wiki

Essential Tools

Site: https://mad9112.github.io/F2022/modules/week1/


Command line shortcuts

  • pwd : displays current working directory
  • ~ : goes to user directory.
  • / : goes to root directory. So it is possible to make a dir change: /Users. It is the absolute path.
  • open . will open the finder in current directory.
  • Absolute paths always start with forward slash: /

Changing file permissions

Examples:

  • chmod u=rwx,g=rx,o=r myfilename : This sets the access for different user types
  • chmod u+x myfilename": This adds permission to the given group
  • chmod u-x myfilename Removing permisson is also possible with this parameter.

Wildcards in file-matching

Star (*)

Will match text as you know it.

week*.md -> * represents zero or more characters between "k" and "."

Question mark (?)

Will match only one character.

week?.md -> "?" represents one character only. week??.md -> there has to be exactly two characters between "k" and "."

Square brackets ([])

Will match a group of characters, or a range of characters depending on the format. Each [] represents a single-character match

Week0[125][0-9].md -> This means the file should be in this format: Week0[x][y].md and [x] can be either 1,2 or 5. and [y] can be a character between 0 and 9. So a successful march: Week050.md

Curly brackets

This is a string match.

taxes_{may,june}.md would match taxes_may.md and taxes_june.md only.

Terminal

Some common commands: pwd, cd, ls, mkdir, rmdir, touch, rm, Some commands Vladimir didn't cover: cp to copy

Some additional commands:

  • echo "Hello World" >> file.txt : Creates a file with "Hello World" text in it
  • `more " will display the contents of the file
  • cp file1 file2 : Copy file1 as file2
  • mv file1 file2 : Moves file1 as file2, or mv file1 ../folder/file2
⚠️ **GitHub.com Fallback** ⚠️