see whats getting written into all of the open logfiles under /var/log

eval `lsof +D /var/log|(read;awk '{print "tail -f " $9 " &" }'|sort|uniq)`
The result will be a bunch of 'tail' commands running in the background in your current shell.

0
By: p_b_r
2016-08-25 20:23:38

These Might Interest You

  • you open multiple files and you have a pattern to be replace on each one of them. For example the pattern is like this spread across hundred's of files. package1-1.12 package2-2.33 The goal is to remove the hyphen ('-') and replace with space on file{1..3} It should look like package1 1.12 package2 2.33 Here how it can be done. vim file{1..3} :bufdo :%s/-\([0-9]\)/ \1/g | w! "a1" 2L, 30C written "a2" 2L, 30C written "a3" 2L, 27C written Show Sample Output


    0
    :bufdo :%s/<what-was>/replace-to/g | w!
    sameergawande · 2015-04-22 15:05:47 0
  • Written for Mac OSX. When you are working in a project and want to open it on Github.com, just type "gh" and your default browser will open with the repo you are in. Works for submodules, and repo's that you don't own. You'll need to copy / paste this command into a gh.sh file, then create an alias in your bash or zsh profile to the gh.sh script. Detailed instructions here if you still need help: http://gist.github.com/1917716


    1
    git remote -v | grep fetch | sed 's/\(.*github.com\)[:|/]\(.*\).git (fetch)/\2/' | awk {'print "https://github.com/" $1'} | xargs open
    brockangelo · 2012-04-15 20:48:46 1
  • Oracle DBA remove some logfiles which are still open by the database and he is complaining the space has not been reclaimed? Use the above command to find out what PID needs to be stopped. Or alternatively recover the file via: cp /proc/pid/fd/filehandle /new/file.txt Show Sample Output


    12
    find -L /proc/*/fd -links 0 2>/dev/null
    res0nat0r · 2009-06-26 18:42:51 2
  • Found it on: http://stackoverflow.com/questions/318789/whats-the-best-way-to-open-and-read-a-file-in-perl The yet most simple way to read all the contents of a file to a variable. I used it in a perl script to replace $text="`cat /sys/...`", and stipping down 9 secs of runtime due less forks


    0
    $text = do {local(@ARGV, $/) = $file ; <>; }; [or] sub read_file { local(@ARGV, $/) = @_ ; <>; }
    matya · 2013-06-12 11:41:49 0

What do you think?

Any thoughts on this command? Does it work on your machine? Can you do the same thing with only 14 characters?

You must be signed in to comment.

What's this?

commandlinefu.com is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.

Share Your Commands



Stay in the loop…

Follow the Tweets.

Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.

» http://twitter.com/commandlinefu
» http://twitter.com/commandlinefu3
» http://twitter.com/commandlinefu10

Subscribe to the feeds.

Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):

Subscribe to the feed for: