Tag Info

New answers tagged


If we are talking about plain, not encrypted traffic, I often see this kind of URLs simply sniffing the connection. I usually use this command (you might have to change the port or the http string): sudo ngrep "http" "port 80"


Use the -exec action in find to execute a command for each file. This executes a program with arguments; if you need a more complex command (with variable expansion, conditionals, etc.) then you need to invoke a shell explicitly: find /dir/* -type f -mtime +14 -exec sh -c ' if …; then rm "$0" fi ' {} \; To test whether a file is currently open, ...


Instead of using lsof which has a nightmare tangle of options and interesting ouput to parse, I suggest using the -atime or -amin options to find. These let you specify the file access time in days or seconds, respectively. Instead of using another process to find out if a file is currently "in use", you can check to see if was accessed within the last N ...


The following should work: for x in `find <dir> -type f -mtime +14`; do lsof "$x" >/dev/null && echo "$x in use" || echo "$x not in use" ; done Instead of the echo "$x not in use" command, you can place your rm "$x" command. How does it work: find files, last modified 14 days or longer ago: find <dir> -type f -mtime +14 loop ...


You have two different selections: lsof -u tomcat7 lists open files belonging to tomcat7, whatever their names. lsof | grep tomcat7 lists open files with tomcat7 in their name ( or as a string in the line, be it user or group) irrespective of their owners.


This is not 100% correct. The string "--" is used only once after the options and before the list of paths, i.e. lsof [options] [--] [names] The following command lsof -- /home4 -- /home2 would give an error unless a file named "--" existed in the current directory. This one should be fine lsof -- /home4 /home2 In general "--" means "end of ...

Top 50 recent answers are included