• Skip to main content

Uly.me

cloud engineer

  • Home
  • About
  • Archives

link

Copy A Symbolic Link

November 27, 2020

Here’s how to copy a symbolic link which is also known as a soft link from one directory to another. A regular copy command will not work. You will need to use the -P option to copy the symbolic link from one directory to another. If omitted, the symbolic links will not be copied.

cp -P /directory1/* /directory2/

cp -P /directory1/* /directory2/

How to create a symbolic link.

ln -s sourcefile myfile
ln -s /path/to/file myfile

ln -s sourcefile myfile ln -s /path/to/file myfile

Here are the man pages for ln and for cp.

Filed Under: Linux Tagged With: copy, cp, create, link, ln, symbolic

Check Network Promiscuous Mode

November 23, 2020

Promiscuous mode is a mode for a network interface where the controller to passes all traffic it receives to the CPU instead of passing the frames to the controller. This is helpful if you want to capture all traffic as part of troubleshooting. The question is, how can you tell if your network interface is in a promiscuous mode? Here’s a couple of commands.

Here’s the default mode.

sudo ip link show eth0
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1460 qdisc mq state UP mode DEFAULT group default qlen 1000
link/ether xx:xx:xx:xx:xx:xx brd ff:ff:ff:ff:ff:ff

sudo ip link show eth0 2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1460 qdisc mq state UP mode DEFAULT group default qlen 1000 link/ether xx:xx:xx:xx:xx:xx brd ff:ff:ff:ff:ff:ff

Here’s promiscuous mode. Look for PROMISC.

sudo ip link show eth0
2: eth0: <BROADCAST,MULTICAST,PROMISC,UP,LOWER_UP> mtu 1460 qdisc mq state UP mode DEFAULT group default qlen 1000
link/ether xx:xx:xx:xx:xx:xx brd ff:ff:ff:ff:ff:ff

sudo ip link show eth0 2: eth0: <BROADCAST,MULTICAST,PROMISC,UP,LOWER_UP> mtu 1460 qdisc mq state UP mode DEFAULT group default qlen 1000 link/ether xx:xx:xx:xx:xx:xx brd ff:ff:ff:ff:ff:ff

The other command is netstat. Look for P flag.

netstat -i
Kernel Interface table
Iface             MTU    RX-OK RX-ERR RX-DRP RX-OVR    TX-OK TX-ERR TX-DRP TX-OVR Flg
eth0             1460 21895816      0      0 0      22645756      0      0      0 BMPRU
lo              65536    44129      0      0 0         44129      0      0      0 LRU

netstat -i Kernel Interface table Iface MTU RX-OK RX-ERR RX-DRP RX-OVR TX-OK TX-ERR TX-DRP TX-OVR Flg eth0 1460 21895816 0 0 0 22645756 0 0 0 BMPRU lo 65536 44129 0 0 0 44129 0 0 0 LRU

Finally, if you want to enable promiscuous mode, run one of these commands.

sudo ip link set eth0 promisc on
ifconfig eth0 promisc

sudo ip link set eth0 promisc on ifconfig eth0 promisc

To disable, use ifconfig.

ifconfig eth0 -promisc

ifconfig eth0 -promisc

Filed Under: Linux Tagged With: ip, link, netstat, promiscuous mode, show

Disable Post Title in Genesis

September 13, 2020

Here’s how to disable the post title in Genesis WordPress themes. Add code in themes.php.

add_filter( 'genesis_link_post_title', '__return_false' );

add_filter( 'genesis_link_post_title', '__return_false' );

Filed Under: WP Tagged With: disable, genesis, link, post, theme, title, wordpress

HTML5 Download Attribute

November 11, 2013

HTML5 has a little-known attribute called download. The download attribute is often used in conjunction with the link or the <a> tag. Check the correct markup for the link tag below. Clicking on a HTML link will typically result in the browser opening up a new page, image, or a document.

In some cases, depending on your browser settings, clicking on a link will download a document, file or an image. For consistency, we can alter the behavior of the link tag by adding the download attribute. Let’s say, we want our readers to download an image, pdf, or a web page. We simply add the download attribute in the link tag.

A typical link looks like this:

<a href="page.html">link</a>

<a href="page.html">link</a>

A link with the download tag would look something like this:

<a href="random-xxx.jpg" download="test.jpg">link</a>

<a href="random-xxx.jpg" download="test.jpg">link</a>

By adding a filename in the download tag, we are specifying that we want the downloaded file to be renamed to test.png. The download attribute is currently supported on Chrome and Firefox. Safari and IE have not adapted it yet. Click on the Sample link below to see the download tag in action.

Demo

Filed Under: HTML Tagged With: download, html5, link

  • Home
  • About
  • Archives

Copyright © 2023