User Tools

Site Tools


useful:linux-commands

This is an old revision of the document!


Contents Page

Linux Commands

Change permissions for whole directory structure

For directories:

  find /desired_location -type d -print0 | xargs -0 chmod 0755
  

For files:

  find /desired_location -type f -print0 | xargs -0 chmod 0644

Adapt as required.

Delete all files with given pattern

   find . -name '*altauserpoints*' -print0 | xargs -0 -P0 rm
   

Adapt as required.

Make a change in every file in a directory

   sed -i 's/foo/bar/g' *
   

To make the change through a whole directory tree:

   find ~/public_html/my_website/pages -type f -exec sed -i 's/2017/2018/g' {} \;
   
useful/linux-commands.1672160291.txt.gz · Last modified: 2022/12/27 16:58 by admin