Useful Linux commands

This command searches through all php files in directories from the current directory recursively for the files that contain the string ‘string’:

find -name *php -exec grep -l "string" {} \;

Show the Linux Distribution:

From the Boot Time messages: dmesg | head -1
Using /proc/version: cat /proc/version
Using /etc/issue (most appropriate): cat /etc/issue

Copy folders and subfolders

cp home/ home_backup/ -R

Count files in a directory

ls -1 | wc -l

List directory with color

ls -l --color=always |more

Leave a Reply