Showing posts with label UNIX. Show all posts
Showing posts with label UNIX. Show all posts

Sunday, June 28, 2015

UNIX - Remove ^M

Open the file with “vi” editor and type the following:

:%s/^M//g

NOTE: To get the ^M in there, you should type CTRL+V+M

Sunday, April 27, 2014

Unix : Grep


grep specific program

ps -ef | grep *batch*
ps -ef | grep batch.sh


grep by username

ps -ef | grep root
ps -ef | grep unixuser



Tuesday, September 4, 2012

Unix : Delete file or Folder


rm foo
delete the file named "foo"

rm a*
delete all files with names beginning with "a"

rm *.jpg
delete all files with names ending in ".jpg"

rm -R temp
delete the directory named "temp", and all of its contents

Wednesday, June 6, 2012

UNIX : Create file using vi and cat

using vi or cat


vi command
> vi test.txt
       and press
      "ESC" button
       ":wq"

done.. type "ls" you will see the new file has been created.

cat command
> "cat > test1.txt"
     and then press "CTRL" + "D"

done.. see your directory..

Wednesday, May 16, 2012

UNIX : Find files that contain a string

Ref for me..

find . -exec grep -l "string to find" {} \;
change the "string to find" to find your string. Please include (")

also can do this..
find . -type f | xargs grep "String to find"