Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 5 years ago.
Improve this question
I couldn't find how i can have the list of IP that try to access my root# (it is a command in Linux but i couldn't find it). And than how can I block an IP from this access.
There is someone that try to access my root# on the server. I need to resolve this problem.
I tried this but don't work :
cat access.log| awk '{print $1}' | sort | uniq -c |sort -n
Just type:
last root
This will give you details of the IP addresses of machines where users logged in as root.
Without knowing your Input_file I am providing this solution, so could you please try following and let me know if this helps you.
awk '{match($0,/[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+/);array[substr($0,RSTART,RLENGTH)]} END{for(i in array){print i,array[i]}}' Input_file
If above is not helping you then kindly show us sample Input_file and expected output file too in code tags, so that we could help you in same.
Related
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 6 years ago.
Improve this question
If the wording of the question is wrong, please let me know. It might explain why I can’t find an answer.
I want to find the usage on my main disk using a command like:
du -sh /*
The problem is that I have a number of mount points at the root level, and I would like du to skip these.
I thought the -x option was supposed to do this, but either I misunderstand what it does or I’m using it the wrong way.
How can I apply du to only the root disk without traversing the additional mounts?
Thanks
du -x will not traverse any mount points it encounters. But if it is told to start at a mount point then it will do as requested.
This is hacky, but it seems to do what you want, from the shell,
for d in /*; do egrep " ${d} " /proc/mounts > /dev/null || du -sh ${d}; done
Add a sudo in front of the du if needed.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 6 years ago.
Improve this question
I have used a command called 'cat /etc/group' what does this command mean and do.Can you tell me what each part of the command does please use simple terms.
You can find the answer to your question explained better than any of us ever could with this command:
man cat
It prints to standard output the contents of the file at the location /etc/group
Ok so cat outputs the file, which (in your case) contains basic info about groups.
If you are interested in what are the groups just click here
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 8 years ago.
Improve this question
Can anyone help explain what the command does on Ubuntu/Debian? Note there is no file called default. But there is one call default-ssl.conf.
sed -i '/AllowOverride None/c AllowOverride All' /etc/apache2/sites-available/default
[Added]I searched the help page already but I am too new to understand the texts.
[Added 2]I conclude it is an ill command.
It won't do anything if there is no file called default.
However, the -i flag means edit in-place, so it changes the file sed was run on.
In place means make changes to the file by actually changing the file, rather than leaving it intact and printing a new copy with the changes sed would make to stdout.
For more information on sed in general, I recommend reading the sed info page - info sed
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 9 years ago.
Improve this question
Is there a trick to show linux command's specific option? Such as I want to know some detail about tar's -z option, and I try this: tar --help | grep '-z' but shows nothing.
So is it possible just show details about specific command option?
Appreciate first if you can help me.
Specifically for the problem of tar --help | grep '-z' not working, do this:
tar --help | grep -- '-z'
Without the --, grep takes -z as an option rather than an argument.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 8 years ago.
Improve this question
Normally in a Linux command you can specify another one to be run at the same time like this:
ls | grep "sys"
for example. In my case I have this command:
urlsnarf -i wlan0
and I can edit it like this to show filtered output:
urlsnarf -i wlan0 | cut -d\" -f4
but I also want to save the output to file and at the same time print text in the console so I edit it like this:
urlsnarf -i wlan0 | cut -d\" -f4 | tee output
but there is neither an output file nor printed output. Is there any way to fix this?
I imagine what's happening here is the pipe is being buffered. I haven't seen urlsnarf before, but it looks like it's a continuous monitoring process. According to the following post, you can't easily stop the pipe from being fully buffered:
How to make output of any shell command unbuffered?
The article linked from an answer there is a good read: buffering in standard streams