Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
Is it possible to get the server UPTIME from mentioning PORT number or Process ID in UNIX command? Please help! Thanks!
From port - I don't think so.
From process ID :
ps -eo pid,etime | grep " 1 " | grep -v grep | awk '{print $2}'
Example:
root#localhost:~[0]$ ps -eo pid,etime | grep " 1 " | grep -v grep | awk '{print $2}'
01:16:10
root#localhost:~[0]$
But you can use uptime command.
Related
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 1 year ago.
Improve this question
What is the way to know the IP address of a website such as Www.google.com by bash script?
ping -c1 www.google.com | grep PING | cut -d"(" -f2 | cut -d ")" -f1
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 2 years ago.
Improve this question
Hel lo I have a df file such as
col1;col2;col3;col4
A;B;C;D
E;F;G;H
I;J;K;L
and I would like to grep I and only display the col1 and col2
and get
I;J then
because from now I only know how to do :
grep 'I' df.csv
I;J;K;L
Try this:
grep 'I' df.csv | cut -d';' -f1-2
The cut command will treat each input line as a list of fields separated by ; (-d';'), and will select only the first two fields (-f1-2) for output.
Sample session:
$ cat df.csv
col1;col2;col3;col4
A;B;C;D
E;F;G;H
I;J;K;L
$ grep 'I' df.csv | cut -d';' -f1-2
I;J
$
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 2 years ago.
Improve this question
Exactly what the title says: what is the bash command for printing out the longest word in a text file that appears at least 10 times.
Try this Denis:
tr -s " " "\n" < file | while read -r l; do echo "${#l} $l"; done | sort -n | awk '$1 >= 10 ' | awk '{print $2}' | tail -n1
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 4 years ago.
Improve this question
Instead of copying and pasting it on the command line.
Is there a way to go through the files, or select them via ID's or something?
You can include a numeric id to your list of files with:
ls | nl
For example if you have this files in your directory:
file1
�%9Cbersicht.html
file2
then ls | nl will give:
1 file1
2 �%9Cbersicht.html
3 file2
from here you can use grep and awk to do other tasks like copying. Example:
ls | nl | grep '\<2\>' | awk '{ print $2 }'
�%9Cbersicht.html # prints the name of the file
or print the file contents:
cat $(ls | nl | grep '\<2\>' | awk '{ print $2 }')
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
ps -ef | grep --color "ilir1477" | awk '{print $NF}'
Please explain to me.
Is this what you are after?
$ ps -u ilir1477 -o args=