Solved

Linux: Change name of the "tail -f /var/log/log.txt" process in PS and TOP

Posted on 2014-03-08
2
380 Views
Last Modified: 2014-03-08
As said above I need the process to be hidden/name-changed for all users. Embedding it into another process like sshd is also acceptable.
0
Comment
Question by:Sanction
2 Comments
 
LVL 68

Accepted Solution

by:
woolmilkporc earned 500 total points
ID: 39915325
Why would you want to do that?

Anyway, I think it's not possible using high level languages like bash or ksh.

Maybe Perl's "File::Tail" module could be useful.

Here is the very basic example from CPAN, slightly adjusted:

  use File::Tail;
  $file=File::Tail->new("/var/log/log.txt");
  while (defined($line=$file->read)) {
      print "$line";
  }

and here is the link, containing a more sophisticated example:
http://search.cpan.org/~mgrabnar/File-Tail-0.99.3/Tail.pm

You could of course go the very easy way by creating softlinks to "tail" as well as to "/var/log/log.txt":

cd /some/dir
ln -s /usr/bin/tail foo
ln -s /var/log/log.txt bar

Now you can run:

cd /some/dir
./foo -f bar
0
 

Author Comment

by:Sanction
ID: 39915362
Thanks, exactly what I was looking for! And to answer your question I am learning Linux Security using offensive tactics.
0

Featured Post

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This Windows batch file is useful for organizing image files from a digital camera or other source, but can have many other uses.  It simply renames the file(s) to match their create date.  For example, if you took a picture today at 1:40pm and the …
Recently, an awarded photographer, Selina De Maeyer (http://www.selinademaeyer.com/), completed a photo shoot of a beautiful event (http://www.sintjacobantwerpen.be/verslag-en-fotoreportage-van-de-sacramentsprocessie-door-antwerpen#thumbnails) in An…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question