Are you sure you want to cancel your subscription?

If you cancel, your subscription will remain active through the paid term. You will be able to reactivate the subscription until that date.

Sorry to see you go

Your subscription will remain active until . If you change your mind, you may rectivate your subscription anytime before that date.

Are you sure you want to reactivate?
Welcome Back!

Your subscription has been reactivated and you will continue to be charged on .

Reactivate Subscription

Thank you for choosing to reactivate your subscription. In order to lock in your previous subscription rate, you owe: .

Your Subscription term is from - .

Questions? Call Sales.

541-284-5522
Payment Due:

OK
Auto-Renew Subscription

To auto-renew your subscription you need to select or enter your payment method in "Your Account" under Manage Payments.

Click continue to set up your payments.

CBT Nuggets License Agreement


Unless otherwise stated all references to “training videos” or to “videos” includes both individual videos within a series, entire series, series packages, and streaming subscription access to CBT Nuggets content. All references to CBT or CBT Nuggets shall mean CBT Nuggets LLC, a Delaware limited liability company located at 44 Country Club Road, Ste. 150, Eugene, Oregon.


A CBT Nuggets license is defined as a single user license. Accounts may purchase multiple users, and each user is assigned a single license.


  • GRANT OF LICENSE. CBT Nuggets grants you a non-transferable, non-exclusive license to use the training videos contained in this package or streaming subscription access to CBT content (the “Products”), solely for internal use by your business or for your own personal use. You may not copy, reproduce, reverse engineer, translate, port, modify or make derivative works of the Products without the express consent of CBT. You may not rent, disclose, publish, sell, assign, lease, sublicense, market, or transfer the Products or use them in any manner not expressly authorized by this Agreement without the express consent of CBT. You shall not derive or attempt to derive the source code, source files or structure of all or any portion of the Products by reverse engineering, disassembly, decompilation or any other means. You do not receive any, and CBT Nuggets retains all, ownership rights in the Products. The Products are copyrighted and may not be copied, distributed or reproduced in any form, in whole or in part even if modified or merged with other Products. You shall not alter or remove any copyright notice or proprietary legend contained in or on the Products.
  • TERMINATION OF LICENSE. Once any applicable subscription period has concluded, the license granted by this Agreement shall immediately terminate and you shall have no further right to access, review or use in any manner any CBT Nuggets content. CBT reserves the right to terminate your subscription if, at its sole discretion, CBT believes you are in violation of this Agreement. CBT reserves the right to terminate your subscription if, at its sole discretion, CBT believes you have exceeded reasonable usage. In these events no refund will be made of any amounts previously paid to CBT.
  • DISCLAIMER OF WARRANTY AND LIABILITY. The products are provided to you on an “as is” and “with all faults” basis. You assume the entire risk of loss in using the products. The products are complex and may contain some nonconformities, defects or errors. CBT Nuggets does not warrant that the products will meet your needs, “expectations or intended use,” that operations of the products will be error-free or uninterrupted, or that all nonconformities can or will be corrected. CBT Nuggets makes and user receives no warranty, whether express or implied, and all warranties of merchantability, title, and fitness for any particular purpose are expressly excluded. In no event shall CBT Nuggets be liable to you or any third party for any damages, claim or loss incurred (including, without limitation, compensatory, incidental, indirect, special, consequential or exemplary damages, lost profits, lost sales or business, expenditures, investments, or commitments in connection with any business, loss of any goodwill, or damages resulting from lost data or inability to use data) irrespective of whether CBT Nuggets has been informed of, knew of, or should have known of the likelihood of such damages. This limitation applies to all causes of action in the aggregate including without limitation breach of contract, breach of warranty, negligence, strict liability, misrepresentation, and other torts. In no event shall CBT Nuggets’ liability to you or any third party exceed $100.00.
  • REMEDIES. In the event of any breach of the terms of the Agreement CBT reserves the right to seek and recover damages for such breach, including but not limited to damages for copyright infringement and for unauthorized use of CBT content. CBT also reserves the right to seek and obtain injunctive relief in addition to all other remedies at law or in equity.
  • MISCELLANEOUS. This is the exclusive Agreement between CBT Nuggets and you regarding its subject matter. You may not assign any part of this Agreement without CBT Nuggets’ prior written consent. This Agreement shall be governed by the laws of the State of Oregon and venue of any legal proceeding shall be in Lane County, Oregon. In any proceeding to enforce or interpret this Agreement, the prevailing party shall be entitled to recover from the losing party reasonable attorney fees, costs and expenses incurred by the prevailing party before and at any trial, arbitration, bankruptcy or other proceeding and in any appeal or review. You shall pay any sales tax, use tax, excise, duty or any other form of tax relating to the Products or transactions. If any provision of this Agreement is declared invalid or unenforceable, the remaining provisions of this Agreement shall remain in effect. Any notice to CBT under this Agreement shall be delivered by U.S. certified mail, return receipt requested, or by overnight courier to CBT Nuggets at the following address: 44 Club Rd Suite 150, Eugene, OR 97401 or such other address as CBT may designate.

CBT Nuggets reserves the right, in its sole discretion, to change, modify, add, or remove all or part of the License Agreement at any time, with or without notice.

Billing Agreement


  • By entering into a Billing Agreement with CBT Nuggets, you authorize CBT Nuggets to use automatic billing and to charge your credit card on a recurring basis.
  • You agree to pay subscription charges on a monthly basis, under the following terms and conditions:
    • CBT Nuggets will periodically charge your credit card each monthly billing cycle as your subscription charges become due;
    • All payments are non-refundable and charges made to the credit card under this agreement will constitute in effect a "sales receipt" and confirmation that services were rendered and received;
    • To terminate the recurring billing process and/or arrange for an alternative method of payment, you must notify CBT Nuggets at least 24 hours prior to the end of the monthly billing cycle;
    • You will not dispute CBT Nugget’s recurring billing charges with your credit card issuer so long as the amount in question was for periods prior to the receipt and acknowledgement of a written request to cancel your account or cancel individual licenses on your account.
  • You guarantee and warrant that you are the legal cardholder for the credit card associated with the account, and that you are legally authorized to enter into this recurring billing agreement.
  • You agree to indemnify, defend and hold CBT Nuggets harmless, against any liability pursuant to this authorization.
  • You agree that CBT Nuggets is not obligated to verify or confirm the amount for the purpose of processing these types of payments. You acknowledge and agree that Recurring Payments may be variable and scheduled to occur at certain times.
  • If your payment requires a currency conversion by us, the amount of the currency conversion fee will be determined at the time of your payment. You acknowledge that the exchange rate determined at the time of each payment transaction will differ and you agree to the future execution of payments being based on fluctuating exchange rates.

CBT Nuggets reserves the right, in its sole discretion, to change, modify, add, or remove all or part of the Billing Agreement at any time, with or without notice.

LPI Linux LPIC-1 101 and CompTIA Linux+

Create and Change Hard and Symbolic Links

This video is only available to subscribers.
Start your 7-day free trial today.

A free trial includes:

  • Unlimited 24/7 access to our entire IT training video library.
  • Ability to train on the go with our mobile website and iOS/Android apps.
  • Note-taking, bookmarking, speed control, and closed captioning features.

LPIC1 & CompTIA Linux+ Intro

Hardware Settings

Boot the System

Change Runlevels and Reboot or Shutdown the System

Design Hard Disk Layout

Install a Boot Manager

Manage Shared Libraries

Debian Package Management

RPM & YUM Package Management

Work on the Command Line

Process Text Streams Using Filters

Perform Basic File Management

Use Streams, Pipes, and Redirects

Create, Monitor, and Kill Processes

Process Priorities

Search Text Files with Regular Expressions

Perform Basic File Editing Operations Using vi

Create Partitions and Filesystems

Maintain the Integrity of Filesystems

Control Mounting and Unmounting of Filesystems

Manage Disk Quotas

Manage File Permissions and Ownership

Create and Change Hard and Symbolic Links

00:00:00 - Welcome to nugget 104.6. What we're going to learn
00:00:03 - about - links. We're going to create and change hard links and
00:00:07 - soft links, or symbolic links. It's a pretty simple nugget,
00:00:12 - but it's one of those really cool things in Linux that makes
00:00:15 - your job as an administrator much easier. So like I said, we're going to talk about
00:00:18 - hard links, soft, or symbolic links and we're going to use the
00:00:21 - command Ln. Alright, so let's get to the command line and take care
00:00:25 - of this nugget pretty quick.
00:00:28 - Okay, in my folder here, I've created three different files. Now,
00:00:34 - this is the original file I made, it's a text file. Let's look
00:00:37 - in it, it just has stuff in it here.
00:00:40 - Just a bunch of text, okay. So it's just a text file.
00:00:45 - And I've created a hard link to that file and a soft link, or
00:00:49 - a symbolic link. Again, soft link, or symbolic link, pretty much mean
00:00:53 - the same thing. I'm going to explain what the difference is, what they mean,
00:00:56 - how you can identify them. And then we'll talk about how we
00:00:59 - create these and maybe why we create these. Alright? So again, file.txt
00:01:04 - is the first file that I made. It's the only actual
00:01:07 - file that I made in this directory. Let's do an ls-l and see what it
00:01:11 - looks like.
00:01:13 - Okay, this is a hardlink.txt.
00:01:17 - Now, if you look, they're same size,
00:01:20 - exact same size, same permission, same owner, two different file
00:01:25 - names. And if you remember from our section on hard drives,
00:01:28 - every file has an inode, right? Every file has an inode. Well
00:01:33 - both of these file names point to the same inode, right? What
00:01:40 - I'm going to do, I'm going to do ls-li to show inodes.
00:01:45 - And you'll see this file.txt, is pointing to this inode.
00:01:50 - 600432.
00:01:54 - This is pointing to the exact same inode. For all intents
00:01:58 - and purposes, it doesn't matter which file I created first, they
00:02:02 - are both linked to this inode, or this file. If I edit this
00:02:07 - file, here, let's do that.
00:02:11 - Let's edit this file and we'll get rid of all this stuff down here.
00:02:18 - We'll save it, ls-l, you'll see I changed both files.
00:02:24 - See, it was 147 bytes, now it's 33 bytes.
00:02:27 - I changed both files by just changing one, because
00:02:31 - these names are both linked to the same thing. Now in contrast,
00:02:36 - this is a soft link. And what this does, this just points, instead
00:02:41 - of pointing to the inode,
00:02:43 - what this soft link does, it points to this file name, okay.
00:02:47 - So if we rename this file, like here, let me show you. If I
00:02:51 - cat softlink.txt, see it's pointing to file.txt.
00:02:57 - So it just printed that right out, alright? But what if we
00:03:04 - change the name of file.txt to newfile.txt.
00:03:10 - Let's look. Now it's changed, because now this is a broken link, okay.
00:03:15 - Now see, as far as hardlink and newfile, they don't care,
00:03:19 - right. Because they're pointing to the same inode.
00:03:22 - ls-li. See, they're still pointing to the same inode. It
00:03:25 - doesn't matter what we name them when it comes to hard linking.
00:03:28 - But for a soft link, this is now broken. If we try to cat this,
00:03:33 - it's going to say there's no such file or directory, because
00:03:35 - it's basically just pointing to the file name, file.txt, and
00:03:39 - that no longer exists. So that's the difference between a
00:03:42 - soft link and hard link. A hard link is linking to a specific
00:03:46 - inode, or the same file. These are both pointing to the same
00:03:49 - file. If we delete one, the file is still there, because the other
00:03:53 - name is pointing to it. But with a soft link, all it's doing
00:03:56 - is pointing to the file name. So this is now broken, okay. And
00:04:02 - that's really the only difference between hard links and soft links. Next, I'll
00:04:05 - show you how to make them. So let's
00:04:10 - get rid of everything, so there's nothing up my sleeve here.
00:04:14 - We're going to --
00:04:22 - this is my file, okay. Just use vi, write quit. So now, we
00:04:27 - have a file, okay. Now, if we're going to hardlink, we would
00:04:31 - ls-li. See, they're still pointing to the same inode. It
00:04:33 - the source, file.txt, and the destination. What we
00:04:38 - want to link it to.
00:04:42 - hard.txt.
00:04:45 - We do this, see now we have two files that are exactly the same and you
00:04:49 - can see that they're literally exactly the same, they're both
00:04:51 - pointing to the same inode.
00:04:53 - Now there's a catch here. First, I'll show you how to do the symbolic
00:04:57 - link. Ln-s, source file, let's say file.txt
00:05:03 - to
00:05:06 - softy.txt
00:05:09 - and see, now what's happened, is softy is linked to file.txt.
00:05:12 - So you're probably thinking, okay, why would you ever
00:05:16 - want to do a soft link then? Because if we change one of the names
00:05:20 - of those files a soft link is broken, it's done. Well, if it's pointing
00:05:25 - to the same inode, you can't have a hard link that links
00:05:30 - across file systems. For example, do you remember our other mounted
00:05:35 - partition, that we did in an earlier nugget?
00:05:41 - We did this when we were talking about quotas and groups last
00:05:43 - time. But there's a file in here called bigfile.txt.
00:05:46 - Now this is on another partition completely, okay. So,
00:05:51 - the things that hard links are limited with, is you can't link
00:05:54 - across different devices. So, we try to do this,
00:06:04 - to home/spowers/hardlinked/bigfile.txt
00:06:18 - It's going to say invalid cross device link, see, because it
00:06:22 - can't point to an inode on a different drive. I mean,
00:06:25 - there can't be, you know, a pointer to another drive located on this drive.
00:06:30 - It just doesn't work, it has to be on the same device. So that
00:06:32 - the inodes are all the same. That's where soft links, or symbolic
00:06:37 - links, come in handy.
00:06:42 - ln-s/mnt/hard_drive/bigfile.txt to /home/spowers/softlinkedbigfile.txt.
00:06:48 - This will work just fine, see?
00:06:55 - So softlinkedbigfile points to that file and now we can look at it
00:07:00 - if we want. Softlinkedbigfile. This is HUGE!!!!! Okay, so that's the content of
00:07:07 - this file, and it's soft linked over.
00:07:10 - Now, you can see where hard links can be very useful. So you can have
00:07:15 - a file located on one inode, you know, so if you change
00:07:18 - it, regardless of which file you change, it's modified.
00:07:22 - But soft links are much more versatile in how they work across
00:07:25 - different directories, or not different directories,
00:07:28 - but different devices, okay. So that's a big key, and now where
00:07:32 - would you use this in every day system management? A great
00:07:37 - example is found in Red Hat. Like in Red Hat, or Centos Red Hat
00:07:42 - Enterprise Linux, or in Centos or any of those Red Hat distributions.
00:07:47 - What they do is they will link -- see if you want to edit the
00:07:50 - grub configuration file, we learned that it's in
00:07:55 - /boot/grub/ directory, right? It's in here, it's the menu.lst.
00:07:59 - Well, that isn't really standard for where most configuration
00:08:03 - files are kept. Normally they're kept in the etc directory, or in the et cetera
00:08:07 - directory. So, what happens on Red Hat, but
00:08:11 - we can do that if we want, go to the etc directory.
00:08:15 - We'll type sudo, because we don't have write access as the user spowers
00:08:18 - in the etc directory. And we'll -- ln-s.
00:08:24 - Now, why would I say minus s? Why wouldn't I -- well let's
00:08:26 - do it, then we'll explain why I wouldn't do it with a hard link. We're
00:08:30 - going to do boot/grub/menu.lst
00:08:33 - and we're going to call it
00:08:37 - grub.conf, okay. So we do that,
00:08:46 - and you'll see now, in the etc directory is a file called
00:08:49 - gub.conf, that points to boot/grub/menu.lst. Now, this is a
00:08:54 - standard you'll find, like I said, in Red Hat based distributions,
00:08:58 - but it's really convenient for me. That way, if I want to edit the
00:09:01 - grub configuration, it's easy to remember. It's in the etc
00:09:05 - directory, grub.conf. That's easier to remember than boot/grub/menu.lst.
00:09:09 - Alright, so that's one of the things that
00:09:12 - symbolic linking is used for, and why is it a symbolic link
00:09:15 - and not a hard link? Well, in my particular case a hard link
00:09:19 - would have worked, because my boot folder is just a folder inside
00:09:23 - the root directory. But it's very common for the boot directory
00:09:29 - to be a separate partition, a very small partition, a boot partition.
00:09:32 - In which case, we wouldn't be able to hard link to the etc
00:09:36 - directory, or the etc directory, because it would be a different
00:09:40 - device, alright? So that's where a symbolic link comes into play.
00:09:43 - And that's just one example of ways that you can use symbolic
00:09:47 - linking to make it a lot easier to edit files. A lot of times,
00:09:51 - if there's a file I edit very often, like in my Linux terminal
00:09:54 - server, what I do is, I will link the configuration
00:09:58 - file, which is nested very deep into var/lib/tft/b/boot,
00:10:04 - all kinds of stuff, I'll just make a symbolic link of that
00:10:07 - file in my home directory, and then I can edit it from there, and
00:10:10 - that's a lot easier then typing that long path, okay. So that's
00:10:14 - all there is to symbolic linking. I guess if there's one more
00:10:17 - thing, the only other thing I can think of, is when you give
00:10:21 - in an argument, like let's say we're going to ln-s file.txt
00:10:25 - and we're -- you know what, let me a folder, so I can make my point.
00:10:32 - Folder. And let's say I'm going to do ln-s file.txt, and the
00:10:39 - destination is going to be a folder name, instead of an actual
00:10:43 - name of a file, so I'm -- basically, I'm saying, make a symbolic link
00:10:48 - of file.txt, in this folder. Press enter, and then if
00:10:52 - you look
00:10:54 - inside the folder, called folder, what it's done,
00:11:00 - it's created the link and called it file.txt,
00:11:04 - but, it's pointed it to something that doesn't exist, right? All we
00:11:08 - told it to do, is link to file.txt. We didn't give
00:11:12 - it a path. So you have to be extremely careful. The file.txt
00:11:15 - by default, if you don't put the name of a file
00:11:19 - at the end, it will just name it the same file in that folder. But,
00:11:22 - if you're going to do something in a folder, or basically, in
00:11:26 - general, it's good to put the full path. Why isn't this working?
00:11:29 - Because it's looking for a file named file.txt in the
00:11:33 - same location. So let's get rid of that.
00:11:39 - And now, how would we properly do this? Well, we would do ln-s
00:11:43 - home/spowers/file.txt folder
00:11:49 - and then, ln-l folder,
00:11:55 - And we'll see, instead of just pointing to something called
00:11:58 - file.txt, it's pointing to the full path, home/spowers/file.txt
00:12:03 - and now it's a working symbolic link.
00:12:06 - So you have to be careful that when you do this, that you're actually
00:12:10 - pointing to something that exists. Because it will create a
00:12:13 - file for you, or a symbolic link for you, even if the file isn't
00:12:17 - there. It just creates that broken link, alright? So you have to be careful
00:12:20 - and then you have to make sure that if your destination's a folder,
00:12:23 - it's just going to make a link the same name. If we want it to
00:12:26 - name it something different, we would type
00:12:30 - ln-s, we would type the full path,
00:12:32 - folder/newlink.txt
00:12:38 - and now it creates it with that new name.
00:12:41 - Alright, I think you learned everything there is to know about symbolic
00:12:44 - linking, but let's go back through it, and make sure we covered everything
00:12:47 - in the L-pick objectives.
00:12:49 - You know what, I did forget one thing. So let's go over
00:12:52 - it and then we'll check the objectives. Alright. In this folder I
00:12:56 - just have one file called file.txt Now, I'm going to
00:12:59 - make a link to of it,
00:13:03 - ln file.txt hardlink.txt
00:13:05 - ln file.txt hardlink.txt Alright?
00:13:07 - So we see that. Now what if I did copy file.txt
00:13:13 - to
00:13:15 - copyoflink.txt or
00:13:19 - copyoffile.txt.
00:13:22 - What you're going to see, it looks exactly the same. And this is where
00:13:26 - you can be confused with copying versus linking. So if you
00:13:30 - have a folder full of these three files, you would really have
00:13:34 - no way to know what's a hard link and what's a file. Would you agree?
00:13:37 - They all look exactly the same. What you would have to do then, is
00:13:41 - ls-li
00:13:44 - and then it will show you the inode. So you know
00:13:48 - these two are hard linked to the same inode. And this
00:13:54 - is a copy. So if we edit this one,
00:14:08 - now this one has grown, these two haven't. But if we were to
00:14:12 - edit one of these --
00:14:25 - now you see that both of these have changed. Because these are really the
00:14:29 - same file, just linked to two different file names, okay. So you can get really
00:14:33 - caught up with, or you can really get confused with hard links versus
00:14:36 - copying a file. So it's always good to remember ls-li
00:14:40 - and that'll show you what inode they're tied to, alright.
00:14:44 - So that really is all of it, but still, let's go back over the objectives
00:14:47 - to make sure we have it all covered, and I didn't miss anything else.
00:14:51 - Okay, we talked about hard links. We talked about what that means,
00:14:54 - what it looks like, and how you can't go across devices with hard
00:14:57 - links. We learned about soft or symbolic links, how you create
00:15:01 - them and some advantages. Like you can symbolically link between
00:15:05 - two different devices, which is really nice for things like
00:15:07 - configuration files. And then we learned about the tool to
00:15:10 - do it all is ln. And then as a last little add on, I talked about
00:15:15 - copy versus linking. Because they're very very different and
00:15:20 - sometimes they're hard to tell the difference, but just remember
00:15:23 - that ls-li shows the inode, that a specific file
00:15:27 - is attached to, okay. I hope that this has been informative for you,
00:15:31 - and I'd like to thank you for viewing.

Find System Files and Place Files in the Correct Location

This forum is for community use – trainers will not participate in conversations. Share your thoughts on training content and engage with other members of the CBT Nuggets community. For customer service questions, please contact our support team. The views expressed in comments reflect those of the author and not of CBT Nuggets. We reserve the right to remove comments that do not adhere to our community standards.

comments powered by Disqus
Community Standards

We encourage you to share your wisdom, opinions, and questions with the CBT Nuggets community. To keep things civil, we have established the following policy.

We reserve the right not to post comments that:
contain obscene, indecent, or profane language; contain threats or defamatory statements; contain personal attacks; contain hate speech directed at race, color, sex, sexual orientation, national origin, ethnicity, age, religion, or disability; contributes to a hostile atmosphere; or promotes or endorses services or products. Non-commercial links, if relevant to the topic, are acceptable. Comments are not moderated, however, all comments will automatically be filtered for content that might violate our comment policies. If your comment is flagged by our filter, it will not be published.

We will be continually monitoring published comments and any content that violates our policies will be removed. Users who repeatedly violate our comments policy may be prohibited from commenting.

Course Features

Speed Control

Play videos at a faster or slower pace.

Bookmarks

Pick up where you left off watching a video.

Notes

Jot down information to refer back to at a later time.

Closed Captions

Follow what the trainers are saying with ease.

MP3 Downloads

Listen to videos anytime, anywhere

Annual Course Features

Transcender Practice Exams

These practice tests help you review your knowledge and prepare you for exams.
Available only with the annual subscription.
Shawn Powers

Shawn Powers

CBT Nuggets Trainer

Certifications:
LPIC-1; CompTIA Linux+, A+; Cisco CCNA

Area Of Expertise:
Linux

Add training to a playlist
or create a new list
Add to current playlist
or add to an existing list
Add to new playlist
Add New Bookmark

Create and Change Hard and Symbolic Links
Bookmark Title:
Whoops

Login is required to access this feature.

Your browser cannot access Virtual Labs
Video Options

This advanced buffering is applied to all streams regardless if you installed the doublespeed control or not. Sometimes the advanced buffering causes the video to hang or behave erratically. If you are experienceing issues with video playback please disable the doublespeed buffer.

Remember to re-enable the buffer if you want to use the doublespeed control.

If you are experiencing problems with our content delivery, please click here to switch to our alternate content delivery network or go to our network FAQ.
For other common video playback issues, including firewall and corporate network issues, please visit our Tech Support forum.