Graduate Program KB

File Pipes and Permissions

  • Pipes
    #output stream | input stream
    #output from the first prog/file will go into the input stream of the prog/file after |
    ls | grep fileName #List files/directories and filters out everything matching "fileName"
  • Output Stream
    #STDOUT
    #1> (Overwrite file)
    #1>> (Appends file)
    #STDERR
    #2>
    #2>>
    #&> (Gets both STDOUT and STDERR)

    #(Puts "Hello into the file.txt")
    echo "Hello" 1> file.txt 
    echo "Hello" 1>> file.txt 
  • File Permissions
    -rwxrwxr-x  1 david david       84 Mar  5 23:48 test.sh
    drwx------  6 david david     4096 Feb 27 16:30 .thunderbird
    drwxr-xr-x  2 david david     4096 Feb 13 09:17 Videos

    #Characters
    #1. d for directory, - for file
    #2-4. Permissions for owner
    #5-7. Permissions for group
    #8-10. Permissions for everyone
    #r: Read 
    #w: Write
    #x: Execute

    chmod +rwx <file> #(To modify files permission)