Skip to content

Tag: bash

How to kill a process by its pid in linux

I’m new in linux and I’m building a program that receives the name of a process, gets its PID (i have no problem with that part) and then pass the PID to the kill command but its not working. It goes something like this: Can someone tell me why it isn’t killing it ? I know that there are som…

Reasoning behind ‘sort’ core util’s key (-k) syntax

When using the sort function in a shell, it seems the preferred syntax for the -k option when sorting via only one field is, for example, -k5n,5. What’s the advantage of the ,5 in this case? -k5n works the same, or at least seems to for me. Refs: The man page seems to prefer this but also suggests it is

Edit field with date in .csv

I have .csv file with lines like this: and i need to change all date and time to this: I think it’s possible using awk and date but until now nothing worked. Answer Some perl: That removes the last 2 comma-separated fields from each line, deletes the fractional time and timezone, reformats the time and …

Getting Output from Cisco C40 via Bash

Background We have a handful of Cisco C40s that I’m trying to automate via bash (although I’d be open to alternatives). I need to log into it, dial an IP, get back the call ID that’s returned, and then use that CallID to send a DTMF tone to the far end. I’m able to get about 90% of the…

How to write a bash script to merge several file into one

I am using the Linux system. I would like to write a script to do these things below. I have few folders named Folder 1, Folder 2, Folder 3 …Folder 100 saved in test.In each folder I have a file named file.txt. How can I write a script to merge the files together. I type one script by myself, However

Starting hadoop – command not found

I have zero experience in hadoop and trying to set up hadoop in ec2 environment. After formatted the filesystem, I tried to start hadoop and it keeps saying command not found. I think I have tried every advice I found on stackoverflow previous questions/answers. Here is the line I am having trouble with: I ha…

Use php exec to launch a linux command with brace expansion

How can I force the php exec() to interpret the linux brace expansion? I am encountering a strange behavior, and did not find a way to fix it the way I want. I want to execute a linux command containing brace expression to select a batch of files, from php I am using php to generate a “random” num…