Recursively find all files that match a certain pattern

With gnu find you can use regex, which (unlike -name) match the entire path: To just count the number of files: (The %i format code causes find to print the inode number instead of the filename; unlike the filename, the inode number is guaranteed to not have characters like a newline, so counting is more reliable. Thanks to @tripleee for … Read more

mv: cannot stat error : No such file or directory error

Normally, when a glob which does not match any filenames is expanded, it remains unchanged. Thus, you get results like this: $ rm .bak rm: cannot remove `.bak’: No such file or directory To avoid this we need to change the default value of nullglob variable. Read more about it here: http://mywiki.wooledge.org/NullGlob Hope this helps!

Extract file basename without path and extension in bash

You don’t have to call the external basename command. Instead, you could use the following commands: Note that this solution should work in all recent (post 2004) POSIX compliant shells, (e.g. bash, dash, ksh, etc.). Source: Shell Command Language 2.6.2 Parameter Expansion More on bash String Manipulations: http://tldp.org/LDP/LG/issue18/bash.html

How can I count all the lines of code in a directory recursively?

Try: or (when file names include special characters such as spaces) The SLOCCount tool may help as well. It will give an accurate source lines of code count for whatever hierarchy you point it at, as well as some additional stats. Sorted output: find . -name ‘*.php’ | xargs wc -l | sort -nr

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)