Keep your working directory clean

With more and more the jobs you ran, the working files occupy the storage. User should periodically clean the unused files to keep our space free. This article provides some useful commands to find out the files you want to delete.

Find files by pattern in a directory

If you want to find out files with the name matches the pattern *.mat in my_dir directory:
find ./my_dir -name "*.mat"
Count the total size of the files found:
find ./my_dir -type f -name "*.mat" -exec du -ch {} + | grep total$
Now you want to delete all of them (reconfirm before deleting!):
find ./my_dir -name "*.mat" -exec rm -rf {} \;
Find files large than 3G and delete:
find ./my_dir -size +3G -exec rm -rf {} \;

Recommanded clean

The following lists some general file pattern which you may want to delete (reconfirm before deleting!):
Software Pattern Discription
Nanodcal .m*.mat runtime temporary files
Nanodcal temporarydata runtime temporary files
VASP WAVECAR wavefunctions
VASP CHG charge density
Quantum Espresso *.wfc *.atwfc *.satwfc wfc*.dat wfcup*.dat wfcdw*.dat wavefunctions

Advanced clean

If you finished you project and make sure no longer to use it, please consider to delete:
Software Pattern Discription
Nanodcal NanodcalObject.mat results of SCF
VASP CHGCAR charge density
Quantum Espresso charge-density.dat charge density

Good habits

Categorize your project directory by date. Once you finish your project, you should clean the unused files. For example:
[lise@stthpc lise]$ ll /work/lise/
total 20
drwxrwxr-x  4 lise labstt   60 Mar  7  2016 work2015_psfexx
drwxrwxr-x  3 lise labstt   21 Feb 24  2018 work2016_vasp
drwxr-xr-x  6 lise labstt 4096 Feb  6  2017 work2017_espresso
drwxr-xr-x  8 lise labstt 4096 Feb 25  2018 work2017_junpy
drwxr-xr-x  3 lise labstt   28 Nov  2  2017 work2017_misc
drwxr-xr-x  8 lise labstt 4096 Nov  6  2017 work2017_nanodcal
drwxr-xr-x  4 lise labstt   36 Jul 24 16:04 work2018
drwxr-xr-x  6 lise labstt   84 Jul 17 13:14 work2018_espresso
drwxr-xr-x  7 lise labstt 4096 Sep 21 20:31 work2018_junpy
drwxr-xr-x  3 lise labstt   38 Jun 28 14:21 work2018_misc
drwxr-xr-x 10 lise labstt 4096 May 22 21:20 work2018_nanodcal
drwxr-xr-x  3 lise labstt   26 Jul 17 13:15 work2018_vasp
drwxr-xr-x  4 lise labstt   52 Jul 12 12:04 work2018_wannier90
[lise@stthpc lise]$ ll work/lise/work2018_nanodcal
total 8
drwxr-xr-x  6 lise labstt 4096 Feb 20  2018 1_CobaltChain
drwxr-xr-x  4 lise labstt   44 Dec 24  2017 2_CarbonChain
drwxr-xr-x 16 lise labstt 4096 Mar  9  2018 3_CoNW_B3Atip_BDA
drwxr-xr-x  5 lise labstt   42 Feb 25  2018 4_simple_Fe
drwxr-xr-x  6 lise labstt   81 Mar  5  2018 5_simple_Graphene
drwxr-xr-x  7 lise labstt  110 May 25 16:19 6_Fe-MgO-Fe
drwxr-xr-x  4 lise labstt   29 May 17 22:30 7_Fe-vacuum-Fe
drwxr-xr-x  6 lise labstt   88 Jun  3 22:41 8_CoCu