Skip to content

Instantly share code, notes, and snippets.

@ConnerWill
Last active June 27, 2022 16:04
Show Gist options
  • Save ConnerWill/cb76af23477563bd59ab6a7b83b6a8d7 to your computer and use it in GitHub Desktop.
Save ConnerWill/cb76af23477563bd59ab6a7b83b6a8d7 to your computer and use it in GitHub Desktop.
Hide stdout and stderr with this code after your command
#############################################################################
#############################################################################
## ##
## Hide stdout and stderr with this code after your command ##
## ##
## > /dev/null 2>&1 ##
## ##
## EXAMPLE: ##
## ##
## This command will now show any output: ##
## ##
## ls -A -l /nonexistent > /dev/null 2>&1 ##
## ##
## This command outputs the dir doesnt exist without '> /dev/null 2>&1': ##
## ##
## $ ls -A -l /nonexistent ##
## ls: cannot access '/nonexistent': No such file or directory ##
## [1] 88237 exit 2 ls -A -l /nonexistent ##
## ##
#############################################################################
#############################################################################
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment