Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

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

Posted on 2014-03-08
2
382 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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Have you ever been frustrated by having to click seven times in order to retrieve a small bit of information from the web, always the same seven clicks, scrolling down and down until you reach your target? When you know the benefits of the command l…
​Being a Managed Services Provider (MSP) has presented you  with challenges in the past— and by meeting those challenges you’ve reaped the rewards of success.  In 2014, challenges and rewards remain; but as the Internet and business environment evol…
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…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

860 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