Visit Our UNIX and Linux User Community

File is not empty?

Thread Tools Search this Thread
Top Forums Shell Programming and Scripting File is not empty?
# 8  
Old 07-12-2007
lsof command

we can use losf for this problem .if using this command we can find out whoever opened the wich files also we can find based on the username and login anme etc..


lsof -c names -u ^user

the above command used for show the files are opened by processess whose names startes with "names", but exclude those whose owner is the user "user".

we can have more options in lsof command (-t,nl,-u,-c..etc)


Previous Thread | Next Thread
Test Your Knowledge in Computers #436
Difficulty: Easy
React is an open source JavaScript library.
True or False?

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

awk to reformat output if input file is empty, but not if file has data in it

The below awk improved bu @MadeInGermany, works great as long as the input file has data in it in the below format: input chrX 25031028 25031925 chrX:25031028-25031925 ARX 631 18 chrX 25031028 25031925 chrX:25031028-25031925 ARX 632 14... (3 Replies)
Discussion started by: cmccabe
3 Replies

2. Shell Programming and Scripting

if/else with an empty file...

Hi there, I'm just starting out with shell scripting and I'm trying to make a test where the script will basically run yum check-update to find out if the server has any available and if it does it e-mails me but if not it will just stop there. I have it working if there are actually... (7 Replies)
Discussion started by: Imnewtothis
7 Replies

3. Shell Programming and Scripting

Empty out the file

Hi All, I have a piece of perl code in which I DON'T want to delete a file rather empty out the contents, here is the code - if ( unlink("$opt_b") == 1 ) { print_log( "$opt_b deleted", 1 ); }else { print_log( "Could not delete $opt_b:$!", 1 ); ... (5 Replies)
Discussion started by: jacki
5 Replies

4. Shell Programming and Scripting

while file is empty

how can i use while loop ? while file is empty do.... if not empty do ..... in bash (1 Reply)
Discussion started by: Trump
1 Replies

5. UNIX for Dummies Questions & Answers

Getting same exit status for empty and non empty file

Hi All, I am checking for a empty input file to do some further action , but I am getting exit status 0 in both the cases , for empty and non empty file both. The value of $? is coming 0 in if part also and else part too. #!/bin/ksh if ]; then echo "data" # exit 0 echo "$?" else... (4 Replies)
Discussion started by: mavesum
4 Replies

6. Shell Programming and Scripting

how to see if the file is empty or not?

hi how can I determine, if a file is empty or not?I am using read line clause. The script should be like: while read line do if(file is empty) then; ...... done < $blacklist (1 Reply)
Discussion started by: tjay83
1 Replies

7. UNIX for Dummies Questions & Answers

Trying to empty file using > but the file size increasing when next append

AIX 5.3 / KSH I have a Java application which creates a log file a.log. I have a KSH script which does the following action cp a.log /directory2/b.log > a.log After this the file size goes to 0 as per "ls -l" Then next time when the application writes into this file, the file size... (4 Replies)
Discussion started by: firdousamir
4 Replies

8. UNIX for Dummies Questions & Answers

how to find empty folders without using -empty

hi all: my solaris FIND does not support find myFolder -type d -empty how can i find the empty folders? thanks! (7 Replies)
Discussion started by: lasse
7 Replies

9. Shell Programming and Scripting

How to empty a file(already created)

What is the command to empty an already existing file. please provide me.i used Touch cmd to empty the file.but it changing the time only. (4 Replies)
Discussion started by: laknar
4 Replies

10. UNIX for Advanced & Expert Users

empty file in hp-ux

Hi, I need your help. How can I create an empty filename with a specific size, in hp-ux? Regards, Mizi (2 Replies)
Discussion started by: Mizi
2 Replies
secure_sid_scripts(5)						File Formats Manual					     secure_sid_scripts(5)

secure_sid_scripts - controls whether setuid and setgid bits on scripts are honored VALUES
Failsafe Default Allowed values Recommended values DESCRIPTION
This tunable controls whether and bits on executable scripts have any effect. Honoring on scripts make a system vulnerable to attack by malicious users. The default value for this variable is 1, indicating that bits are to be ignored by the execve(2) system call for higher security. The tunable can be set to 0 for a compatibility with older releases at the expense of security. Hewlett-Packard strongly recommends that you not change the value of this tunable unless there is an urgent need to do so. When a script with bits is executed, the kernel generates the following error message to both the terminal controlling and the system log. (To view the error message, use dmesg(1M) or inspect Who is Expected to Change This Tunable? Administrator. Restrictions on Changing Changes to this tunable take effect for new scripts started after the change. When Should the Value of This Tunable Be Changed? This tunable controls operational modes rather than data structure sizes and limits. The appropriate setting for a system depends on whether you consider security or compatibility to be most important. A value of is compatible with previous releases of HP-UX, but it is also less secure. A value of provides security against race condition attacks exploiting scripts. What Are the Side Effects of Changing the Value This tunable controls only executable scripts (not programs) with bit set. HP-UX does not ship with any such scripts. If the customer wishes to use scripts, third party applications such as or can be used. Alternatively, the shell script can be wrapped in a simple C pro- gram that runs the shell script with appropriate permissions: What Other Tunable Values Should Be Changed at the Same Time? None. WARNINGS
None. All HP-UX kernel tunable parameters are release specific. This parameter may be removed or have its meaning changed in future releases of HP-UX. Installation of optional kernel software, from HP or other vendors, may cause changes to tunable parameter values. After installation, some tunable parameters may no longer be at the default or recommended values. For information about the effects of installation on tun- able values, consult the documentation for the kernel software being installed. For information about optional kernel software that was factory installed on your system, see at FILES
was developed by HP. SEE ALSO
chmod(1), execve(2), kctune(1M). Tunable Kernel Parameters secure_sid_scripts(5)

Featured Tech Videos