LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Blogs
User Name
Password

Notices


Old

BASH datetime for scripts

Posted 04-05-2020 at 05:16 PM by karanis
Tags bash, time

#!/bin/bash
dt=`date '+%d/%m/%Y %H:%M:%S'`
echo "$dt"
LQ Newbie
Posted in Uncategorized
Views 296 Comments 0 karanis is offline
Old

BASH get ip from ifconfig ( and grep hostname from /etc/hosts by IP)

Posted 04-05-2020 at 05:13 PM by karanis
Updated 04-05-2020 at 05:15 PM by karanis
Tags bash, net

#!/bin/bash

IP=`/usr/sbin/ip addr show dev eth0| grep -v inet6| awk ' !/127.0.0.1/ && /inet/ { gsub(/\/.*/, "", $2); print $2 }'`
grep $IP /etc/hosts | sed -r s/$IP\\s\\t//
LQ Newbie
Posted in Uncategorized
Views 784 Comments 0 karanis is offline
Old

BASH delete line from file

Posted 04-05-2020 at 05:12 PM by karanis
Tags bash

https://www.folkstalk.com/2013/03/se...-examples.html

sed '/^u/d' file
Deletes a line starting with u
LQ Newbie
Posted in Uncategorized
Views 185 Comments 0 karanis is offline
Old

BASH fork

Posted 04-05-2020 at 05:11 PM by karanis
Tags bash, fork

#!/usr/bin/bash
function_to_fork() {
...
}

function_to_fork &
# ... execution continues in parent process ...
LQ Newbie
Posted in Uncategorized
Views 209 Comments 0 karanis is offline
Old

nmap Scan Network (better&faster)

Posted 04-05-2020 at 05:10 PM by karanis
Tags bash, net

nmap -sL 192.168.*.* | grep \(1
ip neigh show dev eth1
LQ Newbie
Posted in Uncategorized
Views 259 Comments 0 karanis is offline

  



All times are GMT -5. The time now is 06:07 AM.

Main Menu
Advertisement
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration