Developer Forums | About Us | Site Map
Search  
HOME > TUTORIALS > SERVER SIDE CODING > ADMINISTRATION TUTORIALS > WINDOWS TO LINUX ROADMAP: PART 2. CONSOLE CRASH COURSE


Sponsors





Useful Lists

Web Host
site hosted by netplex

Online Manuals

Windows-to-Linux roadmap: Part 2. Console crash course
By Chris Walden - 2004-05-17 Page:  1 2 3 4 5

Link me up, Scotty!

One compelling feature in the Linux file system is the file link. A link is a reference to a file, so that you can let files be seen in multiple locations of the file system. However, in Linux, a link can be treated as the original file. A link can be executed, edited, and accessed without having to do anything unusual. As far as other applications on the system are concerned, a link is the original file. When you make edits to a file through the link, you are editing the original. A link is not a copy. There are two kinds of links: a hard link and a symbolic link.

A hard link can only reference files in the same file system. It provides a reference to the file's physical index (also called an inode) in the file's system. Hard links do not break when you move the original file around because they all point to the file's physical data rather than its location in the file structure. A hard-linked file does not require the user to have access rights to the original file and does not show the location of the original, so it has some security advantages. If you delete a file that has been hard linked, the file remains until all references have been deleted as well.

A symbolic link is a pointer to a file's location in the file system. Symbolic links can span file systems and can even point to files in a remote file system. A symbolic link shows the location of the original file and requires a user to have access rights to the original file's location in order to use the link. If the original file is deleted, all of the symbolic links become broken. They will point to a non-existent location in the file system.

Both types of links can be made with the command ln <source> <target>. By default ln will make a hard link. The -s switch will make a symbolic link.

# Create a hard link from MyFile in the current
# directory to /YourDir/MyFile
ln MyFile /YourDir

# Create a symbolic (soft) link from MyFile in
# the current directory to /YourDir/YourFile
ln -s MyFile /YourDir/Yourfile

In the above examples, MyFile, /YourDir/MyFile, and /YourDir/Yourfile are all treated as the same file.

Coming out of your shell

Learning to work from the console is a necessary skill for Linux administration. There are tools to avoid the console, but you will always be more limited by what you can do through a tool. Accessing a console is easy, and accessing command documentation is easy too with the man and info commands.



View Windows-to-Linux roadmap: Part 2. Console crash course Discussion

Page:  1 2 3 4 5 Next Page: Resources

First published by IBM developerWorks


Copyright 2004-2017 GrindingGears.com. All rights reserved.
Article copyright and all rights retained by the author.