This is an old revision of the document!
Table of Contents
tasks
remove large directories
Use rsync to delete large directories.
mkdir empty_dir rsync -a --delete empty_dir/ yourdirectory/
As per https://unix.stackexchange.com/questions/37329/efficiently-delete-large-directory-containing-thousands-of-files, it is more efficient than running “rm -rf” or some combination of find + “rm -rf”.
stackoverflow answers I came across
- remove leading and trailing spaces - https://unix.stackexchange.com/a/102021/198064
- search for a string and count the number of characters per line - https://unix.stackexchange.com/questions/400650/counting-the-characters-of-each-line-with-wc
get file modified time in shell script
date +%Y%m%d_%H%M%S -r $input_file
Used it in | https://github.com/KamarajuKusumanchi/rutils/blob/master/python3/black_on_selected.sh
Found it in | https://stackoverflow.com/questions/16391208/print-a-files-last-modified-date-in-bash
tput: unknown terminal "xterm-256color"
When I moved my miniconda3 installation from /home/rajulocal/miniconda3 to /opt/rajulocal/miniconda3, I started getting
tput: unknown terminal "xterm-256color"
To fix it, I did
conda install --force-reinstall ncurses
It turns out that the –fore-reinstall option was important since simply doing
conda install ncurses
was not installing ncurses as it was already uptodate.
Ref:- https://stackoverflow.com/questions/32798940/tput-unknown-terminal-xterm-256color