Find file launching a process
I think my server has been compromised and it has many perl processes running. However, I don't know what file they are being launched from so I can delete it. How can I find this information? ...
I think my server has been compromised and it has many perl processes running. However, I don't know what file they are being launched from so I can delete it. How can I find this information? ...
The string is setup like so: href="PART I WANT TO EXTRACT">[link] ...
So if I have a bash array: ar=( "one" "two" "three" "four") What is the best way to make a new array such that it looks like this: ar-new=( "one" "one two" "one two three" "one two three four" ) I cooked up something that use a for loop inside a for loop and using seq. Is there a better/more elegant way to accomplish this? ...
Hi, recently I had to write a little script that parsed VMs in XenServer and as the names of the VMs are mostly with white spaces in e.g Windows XP or Windows Server 2008, I had to trim those white spaces and replace them with underscores _ . I found a simple solution to do this using sed which is great tool when it comes to string manip...
How can I print the date which is a day before current time in Bash? ...
Hi I want perform sha1sum file1 and sha1sum file2 and perform bitwise OR operation with them using bash. Output should be printable i.e 53a23bc2e24d039 ... (160 bit) How can I do this? I know echo $(( 0xa | 0xb )) but how to extend to 40 hexadecimal digits? Thanks ...
Script test.sh: #!/bin/bash if [[ $# -eq 0 ]]; then echo "no arg" else echo "have arg" fi When I ran it as ./test.sh it said "no arg", which was expected, but if I run it as sh ./test.sh it prints "have arg", but it you print $#, it's zero in both cases. However, the script below #!/bin/bash if [ $# -eq 0 ]; then echo "...
Man page for bash says, regarding -c option: -c string If the -c option is present, then commands are read from string. If there are arguments after the string, they are assigned to the positional parameters, starting with $0. So given that description, I would think something like this ought to work: bash -c "echo arg ...
Hi guys, I'm not sure what the policy is here on asking followup questions. So please excuse me if i'm breaking protocol. Earlier I was constructing a menu in bash ( Here ) And so far I've got it working really good. Code here. while [[ 1 ]] do cat -n "$dumpfile" read -p "Please make a selection, select q to quit: " choice ...
so I'm trying to display only columns at a time first ls -l gives me this drwxr-xr-x 11 stuff stuff 4096 2009-08-22 06:45 lyx-1.6.4 -rw-r--r-- 1 stuff stuff 14403778 2009-10-26 02:37 lyx.tar.gz I'm using this: ls -l |cut -d " " -f 1 to get this drwxr-xr-x -rw-r--r-- and it displays my first column just fine. Then I wa...
Here's a snippet of a bash script I'm writing to log CPU loads: #!/bin/bash # ... irrelevant nonsense ... cmd1="/usr/bin/mpstat -P ALL | egrep '(AM|PM)([[:space:]]+)(0)' | tr -s ' ' | cut -d' ' -f4" ldsys="$(echo $cmd1 | /bin/sh)" # ... irrelevant nonsense ... $ldsys is set properly when the script is executed conventionally from the ...
What is the simplest/best way to ensure only 1 copy of given script is running - assuming it's bash on linux? At the moment I'm doing: ps -C script.name.sh > /dev/null 2>&1 || ./script.name.sh but it has several issues: it puts the check outside of script it doesn't let me run the same script from separate accounts - which I would ...
Is there any reason this script always give me running ? In both cases, when my process is started and when my process is stopped. if ps ax | grep -v grep | grep "processName" > /dev/null then echo $"running" else echo $"not running" fi Thank you very much UPDATE : I add a full exemple of my script, maybe smothing wrong somewhe...
I am construcing a command in bash dynamically. This works fine: COMMAND="java myclass" ${COMMAND} Now I want to dynamically construct a command that redirectes the output: LOG=">> myfile.log 2>&1" COMMAND="java myclass $LOG" ${COMMAND} The command still invokes the java process, but the output is not redirected to myfile.log Addi...
I have several Lua scripts that run experiences and output a lot of information, in text files and in the console. I'd like to add some colors in the console output, to make it more readable. I know that it's possible to color the output of bash scripts using the ANSI escape sequences. For example : $ echo -e "This is red->\e[00;31mRE...
A new kitten in the household has the habit of visiting me while I work, and it is able to make my system do things with a few pawpresses that I didn't know were possible. Windows change their stacking order, browsers magnify parts of previously-closed pages ... Just now, though, while I was working in vim in a window in front of my cyg...
As the title says I want to remove the first 4 letters from a folder name using a Bash script. If you have another way to do it in Linux I don't really mind e.g. Python. Also I need the script to be executed regularly (daily). ...
When I run the MinGW bash shell, I can no longer open the right-mouse menu. when I exit the shell, and return to the cmd.exe shell, the right mouse button works again. Is the MinGW bash version disabling the mouse button somehow? and how can I prevent this? ...
Autoconf scripts have trouble with a filename or pathname with spaces. For example, ./configure CPPFLAGS="-I\"/path with space\"" results in (config.log): configure:3012: gcc -I"/path with space" conftest.c >&5 gcc: with: No such file or directory gcc: space": No such file or directory The compile command from ./configure is ac...
From a programming standpoint, when you set the bash shell to use vi or emacs via set -o vi or set -o emacs What is actually going on here? I've been reading a book where it claims the bash shell uses either of these editors for the input to the shell itself, but I thought it may have used readline. ...