Admin's Choice » All Posts http://www.adminschoice.com/forums/feed/ Fri, 18 May 2018 13:20:21 +0000 http://bbpress.org/?v=2.5.14-6684 en-US http://www.adminschoice.com/forums/topic/how-to-chmod-a-folder-its-subfolders-and-files/#post-2218 <![CDATA[How to chmod a folder, its subfolders and files]]> http://www.adminschoice.com/forums/topic/how-to-chmod-a-folder-its-subfolders-and-files/#post-2218 Thu, 04 Jan 2018 04:54:39 +0000 Hemant Sharma chmod -R 755 can change the permissions recursively but it will change same permissions for everything , folders,subfolders and files.

To selectively change permission , use find command to get the directories or files and then change mode.

find directories and change mode to 755

$find /home/james -type d -exec chmod 755 {} \;

find directories and chand mode to 755

$find /home/james -type f -exec chmod 644 {} \;

]]>
http://www.adminschoice.com/forums/topic/how-to-create-a-symlink-to-a-file-in-unix-and-linux/#post-2217 <![CDATA[How to create a symlink to a file in Unix and Linux]]> http://www.adminschoice.com/forums/topic/how-to-create-a-symlink-to-a-file-in-unix-and-linux/#post-2217 Thu, 04 Jan 2018 04:45:15 +0000 Hemant Sharma symlink in unix/linux are created using ln ( lInK ) command and follows the same syntax as cp and mv command

ln -s

file name has to be either local or with absolute path

-s stand for soft symlink which can span file systems as it just points to existing file name. File contents are lost if original file is deleted.

Without any option ln creates hard link , which is limited to current file system only and point to inode of existing file, file contents are available as long as there is one link exists.

]]>
http://www.adminschoice.com/forums/topic/how-to-find-all-files-containing-a-specific-text-in-linux/#post-2216 <![CDATA[How to find all files containing a specific text in Linux?]]> http://www.adminschoice.com/forums/topic/how-to-find-all-files-containing-a-specific-text-in-linux/#post-2216 Thu, 04 Jan 2018 04:09:41 +0000 Hemant Sharma If you want to do a recursive search and return the line number of found results, grep is best choice.

This is the basic syntax for doing recursive (r ) , Line number (n) and whole word (w) search for pattern.

grep -rnw ‘/some/path/dir/’ -e ‘pattern’

the search can be refined with additional options to include and exclude file and directories.

–exclude *.log
–include *.sh
–exclude-dir /usr/lib
–include-dir /usr/local

for example
grep –exclude *.log -rnw ‘/some/path/dir/’ -e ‘pattern’

]]>