Visit Our UNIX and Linux User Community

Opening output file while still in process

Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Opening output file while still in process
# 1  
Old 03-02-2006
Opening output file while still in process

Dear guru,

Say I have a long process that is executed in this way:

$ nohup perl > output.txt &

Now if I want to view the output file with vi, while process
still running:

$ vi output.txt

Will it kill the process? (seems to me it does). If so how can view the file
without having to kill it.

Thanks and hope to hear from you again.

# 2  
Old 03-02-2006

cat output.txt

Better yet,
tail -f output.txt

# 3  
Old 03-02-2006
Thanks. One more thing, how about copying file before opening it?

$cp outfile.txt newname.txt

$vi newname.txt

Will it kill the process?
# 4  
Old 03-02-2006
Originally Posted by monkfan
Thanks. One more thing, how about copying file before opening it?

$cp outfile.txt newname.txt

$vi newname.txt

Will it kill the process?
No it will not kill the process

# 5  
Old 03-02-2006
the process that is dumping data to an output file will not be killed
untill the environment or the user is changing the permission bits of the file to which it is dumped, or file descriptor problem, invalidating file handler etc.

when we want to view the file where data is dumped the shell provides you with a different file handler without affecting the prime process that is dumping into the file. Hence there is no consistency problem as far as reading a file and taking a copy is concerned.

Previous Thread | Next Thread
Test Your Knowledge in Computers #489
Difficulty: Medium
Because interpreted languages are not compiled, syntax errors do not become runtime errors.
True or False?

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Soft kill a process to redirect the last kbytes output to a file

Hey guys, I have a python script that I call with this line: python >> results.csv &The problem is that the redirection from the stdout to the file results.csv only writes 4096 kbyte blocks. So if i kill this process with kill the last kbytes that the script produce will... (6 Replies)
Discussion started by: Mastaer
6 Replies

2. Shell Programming and Scripting

Opening a file in vi and automatically save and quit this file using shell script

Hi friends, In my shell script, I want to open a file using vi editor. After opening the file in vi, I want to save and quit this file automatically.... all through shell script. the code segment is: ------------------------------------------------------------ cd ~/netfpga/projects/scone/sw/... (2 Replies)
Discussion started by: sachinteotia
2 Replies

3. UNIX for Dummies Questions & Answers

How do I send output of a background process to a file other than nohup.out?

I have a question. I will be running a background process using nohup and & command at end. I want to send output to a file say myprocess.out. So will this command work? nohup myprocess.ksh > myprocess.out & Thanks in advance guys !!! :) (3 Replies)
Discussion started by: vx04
3 Replies

4. Shell Programming and Scripting

How to process select list of files and output to the same file?

Hi, I've a list of files ac_info.tps, subscription_array.tps, .......and many other files one of the file, bin_range_list.tps has the following content CREATE OR REPLACE TYPE "BIN_RANGE_LIST" AS TABLE OF BIN_RANGE_ELEM; / grant execute on... (4 Replies)
Discussion started by: jediwannabe
4 Replies

5. Shell Programming and Scripting

Xmllint - Xml-file problem --ods file not opening

Dear All, this is my first post on this Forum, glad to be here. I'm trying to fix an .ods file. Yes, I had a backup, but it's also corrupted. When opening the document I get this EM: read error format error discovered in the file in sub-document content.xml at 2,337040(row,col). So I... (3 Replies)
Discussion started by: jameslast
3 Replies

6. Shell Programming and Scripting

Appending process output into a file

Hello Friends, I'm trying to save process status of root user sorting by CPU usage. However i couldnt save the continuous, standard outputs into a file. Do you have any idea to do it? prstat -u root -a -s cpu | sed -e '/^$/d;/sleep/d;/Total/d' >> stat.txt >ls -l stat.txt -rw-r--r-- 1... (1 Reply)
Discussion started by: EAGL€
1 Replies

7. Shell Programming and Scripting

cron for windows, process is OK, but application is not opening

Dear All, I need a help. i have an mapped drive application. I want to start this application using cron. I have downloaded cron setup from the below link: And it crontab file works fine. But if i want to start an application. Then process... (2 Replies)
Discussion started by: vasanth.vadalur
2 Replies

8. UNIX for Dummies Questions & Answers

top output for a specific process to a file

Hi, I have the following script, and it is driving me nuts. It just hangs, I've tried all kinds of tricks, but it won't work. I know it can, it is pretty straight forward. It hangs when it tries to output $X Any help appreciated! #!/bin/bash set -o xtrace command="top -b"... (10 Replies)
Discussion started by: Bloke
10 Replies

9. Shell Programming and Scripting

Write process output to a file

When I run <ls -l> to get a list of all the files, I want the displayed result to be written to a text file. Is there a way to do that? (1 Reply)
Discussion started by: kn.naresh
1 Replies

10. Shell Programming and Scripting

Read from file > process > output to file

Hi all, OK, I am totally new to shell scripting as I just started today. All I want from shell scripting is something very basic, and I've been searching for tutorials on "processing files" and I could not find a suitable one for my level. I want to read two columns from a data file, one raw... (3 Replies)
Discussion started by: Lorna
3 Replies

Featured Tech Videos