Showing posts with label unix. Show all posts
Showing posts with label unix. Show all posts

Monday, 21 February 2011

Search a string in directory

Search a string in directory

Shell Script

for i in `ls *`
do
echo $i
cat $i | grep search-string
done

Monday, 9 November 2009

X forwarding. : Error - xterm Xt error: Can't open display:

ERROR:
connection to "host23.0" refused by server
Xlib: Client is not authorized to connect to Server
xhost:  unable to open display "host23.0"

xterm Xt error: Can't open display:

You should enable X forwarding. Note that should be enabled in ssh daemon settings.

$ ssh -X user@host


Link
http://www.linuxquestions.org/questions/linux-software-2/xterm-xt-error-cant-open-display-697237/

Monday, 21 September 2009

How to email the file attachment from unix ?

/usr/bin/uuencode daily.zip daily.zip | /usr/bin/mailx -s "Daily Report" xyz@yahoo.com


Ref Link:
http://www.cyberciti.biz/faq/howto-unix-sending-files-as-mail-attachments/

Friday, 11 September 2009

Explore process Information in unix

Each process has an entry in the /proc filesystem identified by its PID. The following are the important files in /proc directory:
  • pid/cmdline contains the command that was used to start the process (using null characters to separate the arguments).
  • /proc/pid/cwd contains a link to the current working directory of the process.
  • /proc/pid/environ contains a list of the environment variables that the process has available.
  • /proc/pid/exe contains a link to the program that is running in the process.
  • /proc/pid/fd/ is a directory containing a link to each of the files that the process has open.
  • /proc/pid/mem contains the memory contents of the process.
  • /proc/pid/stat contains process status information.
  • /proc/pid/statm contains process memory usage information. 
  • /proc/pid/lwp contains the threads running in the process with the process id

Commands :
ls -l /proc/pid/fd | wc -l
ls -l /proc/pid/lwp | wc -l