Space before command
$ DATABASE_PASSWORD=xxxxxxxx psql ...
Adding a space before the command prevent secrets being stored in the shell history. See $HISTCONTROL.
Split a file into 100M numbered chunks
split --bytes 100M --numeric-suffixes --suffix-length=3 large.csv large-
CP a file from remote to local
scp '1.2.3.4:/home/user/file' ./
Show last 10 modified files
ls -at | head -10
Show a human readable file size
du -h file
Run a file 100 times and say error
macOS only because of say
:
for i in {1..100}; rspec spec/flaky_spec.rb || { say 'test failed please take a look' }
Disk usage
du -sh ./*