Useful UNIX/Linux tips


Find

  • Find all my directories not accessed in the last 30 days in tmp area.
find /tmp/ . -user $USER -type d -atime 30
  • Sum the size of all gds found in a given directory
find /directory/of/interest/. -type f -name '*.gds' -exec du -ch {} + | grep total$
  • Find broken links
find . -xtype l

Disk space

  • Sum available disk in human readable format
df . -h
  • Sum used disk in human readable format, in the current directory
du . -sh
  • Disk used summarized by first 3 level of hierarchy
du . -h --max-depth=3

Vi (gvim)

  • Go to a file under the cursor in gvim:

gf open the highlighted fie in the same window.

gf open the highlighted fie in the same window.

  • Preference for vi: .vimrc
color pablo
syntax on
set tabstop=4
set autoindent
set number
set showmatch
set ignorecase
set smartcase

Date