* SedTool * AwkTool * PerlScripts ### Environment #### printenv ```plaintext printenv # prints environment variables received from parent process printenv VARNAME # prints VARNAME ``` ### Export If a variable is not marked for export, it won't be received from the parent. `printenv` gives you a way to check what is being sent to subprocesses. To export a variable, use ```plaintext export VARNAME ``` and you can also assign at the same time ```plaintext export VARNAME=value ``` ### Date and time ```plaintext date # prints date in human readable format date +FORMAT # use FORMAT string (see manpage) date +%s # print UNIX timestamp TZ="Japan" date # print date and time in Japan ``` ### Processes ```plaintext ps # list processes pgrep | xargs ps # list processes whose names match ``` #### Jobs ```plaintext bg # run job in background fg # run job in foreground jobs # print current jobs kill # send signal to process kill -9 # immediately terminate process (process cannot intercept) kill -15 # tell process to terminate (process can intercept) ``` #### Key combos ```plaintext Ctrl-z # send SIGSTOP to current foreground process Ctrl-c # Interrupt/terminate current foreground process Ctrl-\ # Abort and core dump current foreground process ``` ### Find ```plaintext find . -type f # find regular files find . -type l # find symbolic links find . -type d # find directories find . -name \*x* # find files with an 'x' in their name (\* to avoid expansion) find . -name \*x* -exec command params {} \; # execute command params filename for each file found ```