Great links for bash
Rename multiple files
I have multiple directories with the following format:
directory.name [word123]
directory.name1 [word123]
directory.name2 [word123]
directory.name3 [word123]
etc.
I would like to remove the [word123] from each directory name. It is
unreasonable to perform a mv for each as there are simply too many!
for r in ./*\ \[word123\]; do mv "$r" "${r%\ \[word123\]}"; done
Switch to a fake bash login-shell
exec -l bash # If you're in bash:
bash -c 'exec -l bash' # If you're in another shell
Fake running program name
(exec -a 'vim thesis.tex' nethack)
Deleting file with unprintable characters
One example would be if you open vim and then type :w^Z, where ^Z is created by holding CTRL and clicking Z.
1. Run ls -b to check their escaped name (in my case this will be \032)
$ ls -b
\032 policy.rb upp1.rb
2. Let echo -e print out the name for you in your command
rm $(echo -e "\032")