Last active
April 2, 2018 19:35
-
-
Save djm158/6ca758d5702bc33750c28ac6cd5415bb to your computer and use it in GitHub Desktop.
useful bash utilities
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# grep for multiple patterns and replace a pattern (or leave 'bar' empty to remove that pattern) | |
grep 'pattern1\|pattern2\|pattern3' file | sed 's/foo/bar/g' | |
# list directoy, grab date, time, and filename, sort by most recent | |
ls -l | awk '{print $6, $7, $8, $9}' | sort --reverse | |
# if you only want to ls by time | |
# add -ltr for reverse | |
ls -lt | |
# run process in background without exiting on terminal exit | |
nohup myprogram > myprogram.out & | |
# get the disk usage of a directory | |
du -sh path/to/folder | |
# get number of processors | |
grep -c ^processor /proc/cpuinfo |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment