Web Systems Skill Test Cheat Sheet PDF

Title Web Systems Skill Test Cheat Sheet
Author Calvin K
Course Web Systems
Institution University of Technology Sydney
Pages 1
File Size 95.7 KB
File Type PDF
Total Downloads 879
Total Views 1,017

Summary

Files and directories pwd – display current directory ls [directory] – display list of files cd [directory] – change directory to... mkdir [name of directory] – create directory rmdir [name of directory] – remove directory touch [name] – create a file cp [file] [newFilename] – copy a file rm [file] ...


Description

Files and directories pwd – display current directory ls [directory] – display list of files cd [directory] – change directory to… mkdir [name of directory] – create directory rmdir [name of directory] – remove directory touch [name] – create a file cp [file] [newFilename] – copy a file rm [file] – remove a file cat – output file contents in linux Saving output to file Standard output – use ‘>’ Standard error – use ‘2>’ Append standard output – use ‘>>’ Listing invisible/hidden files ls -a [path] – lists ‘all files’ in directory ls -l [path] – lists files in more detail ls -t – orders files by medication time (new to old) ls -S – orders by size (large to small) ls -r – reverses ^ order way Printing a file to the screen cat [file] – prints file contents to screen less – prints one screen full of content at a time head -n2 [file] – prints first 2 lines of file wc -l [file] – prints number of lines

Inserting text In normal mode, I – (capital i) insets at beginning of line i – insert one character to the left A – append at end of line a – append one character to the right Deleting text D – delete from the cursor to end of line dd – delete the line the cursor is on dnd – delete n lines from cursor down dnw – delete n words dG – delete from cursor to the very end dnG – delect from cursor to line n Search for strings /string – search for string, type n to go to next /a[bB]c – e.g. searches for ‘abc’ or ‘aBc’ /ab*c – e.g. where they can be zero or more b’s /\ -e.g only finds word ‘test’ not ‘testing’ Search and replace or substitute ‘:’ – means command mode ‘%s’ – substitute this on every line ‘/g’ – replace all occurrences Example - :%s/abc/ABC/g Marking to copy text m’letter – mark the first point y’letter – yank the lines from the first point p – pasted the selected text at cursor d’letter – instead of y’ this cuts it and stores.

 u – user  g – group  o – others

 r – readable (4)  w – writable (2)  e – executable (1)

chmod [ugo][+-][rwx] [file] chmod 700 –file executable for only users chmod 777 – makes the file rwx by everyone ./[file] – executes the file

Wildcards * - matches any string ? – matches any single character […] – matches any one of the enclosed characters ls *.exe – list files ending in .exe ls [abc]* - list all files beginning with a, b or c ls *[[:digit:]]* - list files containing a digit [[:alnum:]] – alphanum characters [[:alpha:]] – alphabetic characters [[:blank:]] – blank/tab characters

[[:lower:]] – lower case characters [[:space:]] – space, tab, newline chars [[:upper:]] – upper case characters

Copying directory cp -r [path1] [path2] – copies directory contents recursively

#!/bin/bash – shebang for scripting files chmod 700 [file] – makes file rwx for user Taking Arguments $1 – eg. takes first argument $* - takes all arguments as string $# - stores number of arguments Arithmetic let “a = ($1 + $2)” if [ $a == 5 ] then echo $a else echo ERROR! 1>&2 exit fi Redirecting StdErr/StdOut 2>&1 – sends STDERR to STDOUT 1>&2 – sends STDOUT to STDERR Word count script wc -w [file.txt] ---> 6 file.txt cat [file.txt] | wc -c ---> 6

For cut command to work, data will require commas to separate the fields. Use this :$s/\s\+/,/g Notice that ‘\s\+’ means a sequence of one more white spaces Sorting data cat [file] | sort – sorts contents of file alphabetically Data extraction – cut cat [file] | cut -f1 -d, - takes field 1 and indicates that the comma is the delimiter which separates the fields. Grep pattern matching grep -l [file] – list files that contain a particular string grep -w - will match the word itself but not the word within another word. grep -lr [file] – recursive option NOTE: for no file path, be in the directory your referencing from and use the *. Eg. grep -lr ^Let * Grep Wildcards ^ - match only at start of line $ - match only at end of line [0-9] – Brackets can identify a range can do alphabet as well. E.g. Print all lines with exactly two characters: grep ‘^..$’ filename NOTE: if you want a literal dot to be a letter then escape the dot by ‘\.’ grep -q [file] – quiet option so stdout is not printed grep -i [file] – ignores case

‘wc’ command - w – prints word count - l – prints no. line counts - m – prints character counts Piping cat [file] | wc -m – prints out no. of chars in file Ctrl + d - To terminate grep process or Ctrl + q

$? – checks exit status of grep (0 if found or 1 if not found) Using all of this together f =”$(grep -w $1 table.csv | cut -f2 -d,)” cut -f1-2 -d, table.csv | grep $f | cut -f1 -d, | sort -d...


Similar Free PDFs