os.Mkdir and os.MkdirAll permissions

You can use octal notation directly: os.Mkdir(“dirname”, 0700) Permission Bits +—–+—+————————–+ | rwx | 7 | Read, write and execute | | rw- | 6 | Read, write | | r-x | 5 | Read, and execute | | r– | 4 | Read, | | -wx | 3 | Write and execute | | … Read more

Linux/Unix man page syntax conventions

Square Brackets [ ] The square brackets ( [ ] ) indicate that the enclosed element (parameter, value, or information) is optional. You can choose one or more items or no items. Do not type the square brackets themselves in the command line. Example: [global options], [source arguments], [destination arguments] Angle Brackets < > The … Read more

Run multiple commands at once in the same terminal

This bash script is for N parallel threads. Each argument is a command. trap will kill all subprocesses when SIGINT is catched. wait $PID_LIST is waiting each process to complete. When all processes have completed, the program exits. #!/bin/bash for cmd in “$@”; do { echo “Process \”$cmd\” started”; $cmd & pid=$! PID_LIST+=” $pid”; } … Read more