Skip to content

Print a certain line in linux or options for nslookup

I’m very new to linux and bash. I’m trying to find a domain name for an ip address. When I use nslookup I have a bunch of lines like this Output I only want to print www.computerhope.com in the second line. How do I do this? Also I tried to use host command as well. It looks cleaner. How do

PHP pthreads failing when run from cron

Ok, so lets start slow… I have a pthreads script running and working for me, tested and working 100% of the time when I run it manually from the command line via ssh. The script is as follows with the main thread process code adjusted to simulate random process’ run time. So while the above script…

java is not working in linux. Why?

Currently working on Linux Cinnamon. I have unistall/removed Open JDK from my local drive. Then I checked java -version via terminal and gives – After that following the installation guide to install oracle jdk 8 for linux. Then I just checked java -version command through [I just unpack jdk to /opt/jav…

compiling c++ projects with dlib library on linux

I want to use dlib library for my c++ projects in linux. I have installed it successfully and able to compile and run the .cpp samples files given under the dlib. I have compiled the sample files through the “g++ -std=c++11 -O3 -I.. ../dlib/all/source.cpp -lpthread -lX11 example_program_name.cpp” …

Does Bash ignore # after command?

I know that Bash ignores the # character at the beginning of shell script lines. But in documentation I’d like to add them at the end of lines for documentation: Just in case somebody copies and pastes the literal information I’ve written, will Bash ignore everything after the # character? For eve…

Makefile as simlink: not found

Is it possible to have a Makefile referenced by a simlink, and try calling action using make? I am experiencing that calling make in a directory where Makefile is a simlink, Makefile is not found. I have a need to reduce replication of Makefiles, and I would prefer using simlinks. Suggestions? Answer It shoul…

Converting date format in bash

I have similar different file of the format backup_2016-26-10_16-30-00 is it possible to rename using bash script to backup_26-10-2016_16:30:00 for all files. Kindly suggest some method to fix this. Original file: backup_2016-30-10_12-00-00 Expected output: backup_30-10-2016_12:00:00 Answer To perform only th…