Austin Fox's personal website.

Common Terminal Commands.

|

I tend to forget a lot of this stuff as I don’t use it often (I am not a computer scientist by trade), so here is a list of useful terminal commands. filpath

  • Copy a file

    cp [options] source destination
    

    Options: -f = force, -R = recursive, -v = verbose

  • Permissions

    Current permissions

    ls -l file
    

    Change permissions

    chmod value file
    

    Value: 3 digit code for owner, group, all

    7 = no restrictions, 6 = read write, 5 = read execute, 4 = read, 0 = no access

  • Move/change name of file

    mv [options] source destination
    

    Options: -f = force, -v = verbose

  • Find files and or delete matching a pattern
    find . -name "*.bak" -type f
    
    find . -name "*.bak" -type f -delete
    
  • Find a file or text in a file

    grep [options] search_pattern [file_pattern]
    

    grep = general regular expression program

    search_pattern = a regular expression or string in

    file_pattern = a file or directory or file pattern ex. *.html

    Options: -i = ignore case, -r = recursive, -l = just file names, -n = show line number

    +many more this site seems to have a pretty complete list with good descriptions

    As for Regular expressions there are lots of great resources out there. I may put a post together with the important to me stuff at some point but here are some resources:

    Rexegg

    cheatography

Comments