General :: Filtering UDS From Output Of Netstat Without Grep?
Aug 24, 2010
how I cat to filter out information about Unix Domain Sockets from netstat output without grep? Is there some option for command (I not found it in man of netstat).
Is there some way to filter output of command by OR condition in Linux? There is filtering by AND condition with grep in way like: ls -l | grep "^a" | grep "z$"
That says: list all files that beggins with "a" AND ends with "z" (so there is shorter way to write this: grep "^a.*z$", but it is not matter). Is there some way to perform test by OR condition? For example: files that starts exactly with "xen" OR files that ends exactly with ".rpm". But exactly, not something like: grep "[xen]{0,3}.*[.rpm]{0,4}"
I have some big files of logs that contain errors printed by an app. They are most of the time relevant, however most of them are similar. So i figured i could check what happened between a time interval with a find.
Im using this one
Code:
And I get an output similar to this one.
Code:
Is there a way to condensate the output lines to get only one or two, indicating the start and last occurrence of a block? Or I need to create a program to do so?
Because right now I get thousands of similar lines, but when I'm scrolling through them i sometimes miss relevant information that i would've otherwise noted if it wasn't all that spammy.
I forgot a lot of my command line. I am doing cat file | grep "error" and i would like it to show everything to the right of G:/ including G:/ if possible. I figure its an awk command but i dont know what. I tried awk '{print $8+}' but + does not work like i hoped and guessed.
I have a requirement to find the files having its name as ack_reply. However, there are many other files in the same directory as these resides. Now I have to remove these files from the folder and retain others after 7 days. So I tried to write the below script with grep command.
find $directory -type f -mtime +7 | grep ack_reply
how can I pass this output to -exec command.
If I am not using grep command my script would be as
find $directory -type f -mtime +7 -exec remove.sh {}\;;
I'm trying to grep the output of ngrep. Unfortunately when I add another grep to the pipeline, I get no output at all. It can be some other command too - cat / grep / tee - everything breaks the chain. Example:
[Code]....
If I use cat somefile instead of ngrep at the start, everything works as expected.
I would like to grep two numbers out of a text file, and divide them.
Here is the script code...
It feels like grep saves a new line too? or what is happening? i simply can't divide them, as it handles the variables as they are empty (and prints the two numbers although they were not printed
I am trying to use a shell script to find a string in a file and do something when found. code...
What should happen is pppd will start in a different process and stream it's output to pppdout. pppdout should be created in the current folder. Then the script should periodically check the pppdout file for the string Script (which eventually will appear, some seconds later) and when found exit the script. Ultimately the script will do something useful when the text is found. However, the output from the program is a repeating: 'scriptname.sh: 12: FOUND: not found'
Where scriptname.sh would be the name of your script and 12 refers to the line with 'done'.
Why does grep not find the text, or at least why deos my script not check the grep output correctly?
Code: man -k mail Which lists commands that contain the keyword "mail" in their description.I want the output of this command in less and the words highlighted by grep. Something like
Code: man -k mail | grep mail | less The command doesn't work, how do I fix it?
I want to pipe the output of a command into grep as the search TERM, rather than the text to be searched, like this for example
Code:
cat /var/log/auth.log | grep date "&b &d"
so that I only see the lines in auth.log for the current day...but obviously that line doesn't work.... is there a way to do this with grep, or even another command?
where variable would maybe be the output of grep from fileA. So can I store the output of grep in a variable to use it afterwards with awk ?
something like that:
Code: result=`grep prot. fileA` ; awk 'BEGIN { RS = "###" } /'$result'/' fileB > output but that doesn't work. I'm always getting the entire fileB.
The output of grep get stored in the variable, I verified that with echo. So there is something that I just don't get... It seems to me that the above line should work.
I am developing a node application and there is an option to set the process title (process name). This only sets it in some tools (like ps and top), but not in htop or netstat.
I found this article that explained how most applications do it, but it doesn't change in netstat.
That lead me to wonder where those programs are getting the process name. Would they be getting it from /proc/##/cmdline? (## being the PID of the process)
I figure messing with things in /proc is a bad idea (and probably not possible), so if this is where those programs are getting it, is there a way to change it?
I had a dream least night in which I was on my computer and I was typing the command Netstat -a in command prompt in Ms-Dos. And I was wondering why it looks so much like a Linux terminal command? This question persisted in my mind after I woke up. So what is the story about it?
When I typed netstat -lna, the output: Active Internet connections (servers and established) Proto Recv-Q Send-Q Local Address Foreign Address State tcp 0 0 0.0.0.0:580 0.0.0.0:* LISTEN ... ...
Active UNIX domain sockets (servers and established) Proto RefCnt Flags Type State I-Node unix 2 [ ACC ] STREAM LISTENING 23581 ... ...
Can anyone explain to me: 1. What is "Active Internet connections" & "Active UNIX domain sockets"? 2. What is unix Proto? 3. Difference between LISTEN and LISTENING state.
I'm trying to capture traffic between two machines, A and B. I would like to make sure that the traffic I capture with tcpdump is between eth1 on the local machine and eth0 on the remote machine. As I understand it, the -i flag specifies the local machine interface - but how to set the remote one?
I've been using an old Fortigate-60 at home for the kids for some time but now the license is expired again. Are there any free or inexpensive alternatives? I'd like something I can run on a linux firewall and share against multiple users, with different profiles. In the past I ran squid and I whitelisted sites each kid was allowed to use but this becomes tedious as the kids get older and need access to more. I'd love something that could check a website rating or category list, let the user through for certain categories, and block bad or unrated sites. I don't really need virus checking or email scanning or the like.
Are there any firewalls for Linux that will allow one to block certain ports for a specific application while allowing other programs to use the same port, or block Internet access altogether for specific applications?
Everything based on IPTables apparently can only block ports globally for all applications. SELinux is the only thing I've found so far that might have application-level Internet blocking capability, but it serves a broader array of security purposes and seems too complex for this task.
I don't need interactive popups like with Windows personal firewalls. I'm OK with having to edit a config file. This is for personal desktop Linux use, not a server.
I have created custom rules following: edit > message filters > incoming filter > (custom filter), none work. Also, by right clicking a message and, create rule from message > filter based by subject, sender, and recipients. Accepting all default (auto populated) conditons. None of the filters work at all? Seems this is a popular problem that has not found a solution except to use Thunderbird. not including ThunderbirdWhen I select a message that is supposed to be filtered to a specific folder and go to Message > Apply Filters. message goes to the assigned folder, but I want it to skip the inbox all together.