라벨이 Unix인 게시물 표시

File searching and Remove the searched files in Unix/Linux shell

When it comes to Linux/Unix operating system, you can use shell. 1. Identify detail information of files >>> ls -l 2. Identify detail information of files including sub folders >>> ls -lR or >>> ls -lRs 3. Search files which begin with test >>> ls -lRs | grep -i test* by using '-i' option, you can display the information of location (folders) or >>> find . -name 'test*' -print this would be searching from this present folder 4. Search files which begin with test and then remove all or them >>> find . -name 'test*' -exec rm {} \; -exec command ;       : Execute command. {}                         : The string {} is replaced by the current file name \                         : For escaping 5. Some other usage >>> find . -type d -exec chmod 755 {} '; From this present folder, change all of folder's permission to 755 >>> find . -type f -exe