New to Busy?

LINUXOPOLIS # 24-FEBRUARY-2020 ~ FIND

1 comment

wglenz
54
last month4 min read

FIND

Building a Linux Habitat
willi glenz @ telegram
Published with SteemPeak
home

screenshot by willi glenz

vim ~/.config/fish/functions/gfind.fish

function gfind --description 'find'
    clear; echo
    echo '=========================================================================='
    echo '                                   FIND                                   '
    echo '--------------------------------------------------------------------------'
    echo ' $ dpkg -S $(which find)                                                  '
    echo ' $ apt-cache show findutils                                               '
    echo ' # apt install findutils                                                  '
    echo '=========================================================================='
    echo ' FILES                                                                    '
    echo '--------------------------------------------------------------------------'
    echo ' # find -size +100M | less                                                '
    echo ' # find -size +1G | less                                                  '
    echo ' # find . -name "*.jpg" -exec convert {} -scale 50% +repage {} \;         '
    echo ' # find / -name "*.log" 2> /dev/null | tee logfiles.txt | wc -l           '
    echo ' # find / -size +4G 2> /dev/null | vim -                                  '
    echo ' # find / -type f -perm 0777 -print -exec chmod 644 {} \;                 '
    echo ' # find / -user root -name file.txt                                       '
    echo ' # find /etc -type f -print 2> /dev/null | less                           '
    echo ' # find /etc -type f -print 2> /dev/null | less                           '
    echo ' # find /etc/*tab -type f -print                                          '
    echo ' # find /home -cmin -60                                                   '
    echo ' # find /home -iname file.txt                                             '
    echo ' # find /home -mtime 50                                                   '
    echo ' # find /home -name file.txt                                              '
    echo ' # find /home -size +100M -exec rm -rf {} \;                              '
    echo ' # find /home -type f -name "*.py"                                        '
    echo ' # find /home -type f -name "*.txt" -exec rm -f {} \;                     '
    echo ' # find /home -type f -name "file.txt" -exec rm -f {} \;                  '
    echo ' # find /home -type f -name *.mp3 -size +10M -exec rm {} \;               '
    echo ' # find /home -user user1                                                 '
    echo ' # find /tmp -type f -empty                                               '
    echo ' # find /tmp -type f -name ".*"                                           '
    echo ' # find ~ -maxdepth 1 -type f -exec grep "^alias " '{}' \; -print         '
    echo ' # find ~ -maxdepth 1 -type f -mtime 3                                    '
    echo ' # find ~/Documents -type f -name "*.py" -print | tee ~/python_files.txt  '
    echo '=========================================================================='
    echo; read

    clear; echo
    echo '=========================================================================='
    echo '                                   FIND                                   '
    echo '=========================================================================='
    echo ' USER                                                                     '
    echo '--------------------------------------------------------------------------'
    echo ' # find / -uid 1000 -exec chown -v 1002:1002 {} \;                        '
    echo ' # find / -user userxyz -type f -exec rm -f {} \;                         '
    echo ' # find /home -user userxyz -mtime -3                                     '
    echo ' # find /home -user userxyz -size +1G                                     '
    echo '--------------------------------------------------------------------------'
    echo ' GROUPS                                                                   '
    echo '--------------------------------------------------------------------------'
    echo ' # find /home -group developer                                            '
    echo '--------------------------------------------------------------------------'
    echo ' DIRECTORIES                                                              '
    echo '--------------------------------------------------------------------------'
    echo ' # find . -type f -perm 777 -print                                        '
    echo ' # find / -perm /a=x                                                      '
    echo ' # find / -perm /g=s                                                      '
    echo ' # find / -perm /u=r                                                      '
    echo ' # find / -perm /u=s                                                      '
    echo ' # find / -perm 1551                                                      '
    echo ' # find / -perm 2644                                                      '
    echo ' # find / -type d -name directory                                         '
    echo ' # find / -type d -perm 777 -print -exec chmod 755 {} \;                  '
    echo ' # find / -type f ! -perm 777 -print                                      '
    echo ' # find / -type f -perm 0777 -print -exec chmod 644 {} \;                 '
    echo ' # find /tmp -type d -empty                                               '
    echo '=========================================================================='
    echo
end

SOURCES
 manpages ................................................................ $ man find
 tecmint.com ............... tecmint.com/35-practical-examples-of-linux-find-command/
 man7.org ........................... $ w3m man7.org/linux/man-pages/man1/find.1.html
 alternative .................................................................. $ fzf
 picture ....................................... screenshoot by me ~ my gnome-desktop

Comments

Sort byBest