Details

Today on HakTip I will be checking out some Linux Terminal shortcuts called Wildcards, as well as hard and symbolic links.

Download HD Download MP4

As I've been learning the Linux terminal, I've been sharing what I've found throughout HakTip, and I find it pretty exciting! I'm a nerd, I know. This week, lets check out a few interesting topics- Wildcards, hard links, and symbolic links.

Wildcards are a group of these special characters that you can use to specify a big group of file names instead of having to type out each one. Using wildcards is also called 'globbing'. No really.

Let's check a few of these out. First off, '*', will match 'any characters' with your query. A '?' matches with any single character. [characters] chooses a set character, [!characters] will match with any character that is NOT a member of that group of characters in the bracket. [[:class:]] will match with any character that is a member of a specified class. A class can be a number, letter, lowercase letter, or uppercase letter to name a few.

Examples: I want to copy my pic file, so I could type cp p* Folder1. This will copy any file starting with p to Folder1. I want to move my upgrade.bin file- so I could type mv u*.bin Documents to move any .bin starting with the letter u to my Documents folder. I could replace this with mv p?? to move my pic file. the ?? means any file that starts with p and has two characters after it. I could move my photo and my upgrade.bin file by typing mv [up]*, which means any file that starts with either u or p. The list goes on and on. The cool thing about wildcards is- they also work in the GUI.

The ln command lets you create hard and symbolic links. You can use it by either typing ln file link, or ln -s item link. Basically, a hard link is the original way of creating links- Every file has one and that is what gives the file its name. A hard link creates an additional directory entry for a file, but it can't work outside of it's own filesystem, and it can't reference a directory. They exist, and you may run across them from time to time and wonder what the heck is this? So just know that they are there.

Symbolic links are more modern and more favorable. Think of it as a Window's shortcut. If you remove a symbolic link, only the link is removed, not the original file. I found this short article that explains it well, and gives some examples.

How did you learn the terminal? Got a favorite book, website, or did you learn it all on your own? Tell me about it in the comments or email me at tips@hak5.org. And be sure to check out our sister show, Hak5 for more great stuff just like this. I'll be there, reminding you to trust your technolust.

Category:

Episodes, HakTip

Leave a Reply

Your email address will not be published. Required fields are marked *

*