Home Accessibility Courses Twitter The Mouth Facebook Resources Site Map About Us Contact
 
For 2023 (and 2024 ...) - we are now fully retired from IT training.
We have made many, many friends over 25 years of teaching about Python, Tcl, Perl, PHP, Lua, Java, C and C++ - and MySQL, Linux and Solaris/SunOS too. Our training notes are now very much out of date, but due to upward compatability most of our examples remain operational and even relevant ad you are welcome to make us if them "as seen" and at your own risk.

Lisa and I (Graham) now live in what was our training centre in Melksham - happy to meet with former delegates here - but do check ahead before coming round. We are far from inactive - rather, enjoying the times that we are retired but still healthy enough in mind and body to be active!

I am also active in many other area and still look after a lot of web sites - you can find an index ((here))
Symbolic links and hard links

Files are arranged in directories (or folders if you prefer that term), and each file can be reached through a series of directories and sub-directories from the root - correct? Yes ... BUT ... there are some times that the same file can be reached through several names, and on Unix and Linux systems this is known as a "link".

There are two ways a link can be set up.

A Hard Link is where a file has two names which are both on an equal weighting, and both of the file names in the "inode table" point directly to the blocks on the disc that contain the data. See diagram to the left.

You set up a hard link with an ln command without options - if the file ab.txt already exists and you want to give an additional name (hard link) to it, you'll write
ln ab.txt cd.txt
and then both names will have equal ranking. The only way you'll know that there's a link there is by doing a long listing and you'll see a link count of 2 rather than 1, and if you need to find out what's linked to what, use the -i option to ls.


A Symbolic Link is where a file has one main name, but there's an extra entry in the file name table that refers any accesses back to the main name. This is slighly slower at runtime that a hard link, but it's more flexible and much more often used in day to day admin work.

Symbolic links are set up using the ln command with the -s option - so for example
ln -s ab.txt cd.txt
will set up a new name cd.txt that points to the (existing) file ab.txt. If you do a log listing (ls -l) of a directory that contains a symbolic link, you'll be told that it's a symbolic link with an "l" in the first column, and you'll be told where the file links to in the file name column. Very easy to spot!


Linux Administrators need to be aware of both symbolic and hard links; some of the operating system's files have two names and are installed as hard links, and if the administrator's installing software and wishes to do so under a generic name, there are good arguments for him to do so via a symbolic link.

Symbolic links are also a relatively painless way of placing files onto a disc partition (slice) that's not the one you would expect from the name through which you reference them - which is great if one of your partitions has got nearly full but there's space elsewhere, or if you want to position something on a partition that's got a different backup strategy / system in place to the one of the default location.
(written 2005-06-02, updated 2006-06-05)

 
Associated topics are indexed as below, or enter http://melksh.am/nnnn for individual articles
S153 - Sourcing, Running and Configuring MySQL
  [192] Current MySQL and PHP paths and upgrades - (2005-01-28)
  [489] Which MySQL server am I using? - (2005-11-07)
  [515] MySQL - an FAQ - (2005-12-03)
  [535] MySQL permissions and privileges - (2005-12-20)
  [591] Key facts - SQL and MySQL - (2006-02-04)
  [907] Browser -> httpd -> Tomcat -> MySQL. Restarting. - (2006-10-28)
  [1095] Apache httpd , browser, MySQL and MySQL client downloads - (2007-02-28)
  [1123] mysqldump and mysqlrestore - (2007-03-30)
  [1131] MySQL - Password security (authentication protocol) - (2007-04-02)
  [1689] Some sideways thoughts on the news - (2008-06-27)
  [1731] Apache httpd, MySQL, PHP - installation procedure - (2008-08-01)
  [1771] More HowTo diagrams - MySQL, Tomcat and Java - (2008-08-24)
  [1935] Summary of MySQL installation on a Linux system - (2008-12-11)
  [2085] MySQL - licensing issues, even with using the name - (2009-03-16)
  [2209] Monitoring and Tuning your MySQL installation - (2009-05-31)
  [2426] Which version of MySQL am I running? - (2009-09-26)
  [2444] Potted MySQL installation - (2009-10-09)
  [2445] Securing MySQL on a production server - (2009-10-09)
  [2458] Cant connect to local MySQL server through socket /tmp/mysql.sock - (2009-10-17)
  [4390] Checking MySQL database backups have worked (not failed) - (2015-01-10)
  [4406] Fixing damaged MySQL tables - Error 1712 and Error 2013 - (2015-01-25)
  [4487] Starting MySQL. ERROR! The server quit without updating PID file - how we fixed it. - (2015-05-06)

A162 - Web Application Deployment - Backups and File System Management
  [153] Linux - where to put swap space - (2004-12-16)
  [554] What backup is adequate? - (2006-01-04)
  [593] Finding where the disc space has gone - (2006-02-06)
  [703] Copying files and preserving ownership - (2006-04-28)
  [735] Boys will be boys, saved by Ubuntu - (2006-05-27)
  [754] tar, jar, war, ear, sar files - (2006-06-10)
  [1013] Copy multiple files - confusing error message from cp - (2006-12-30)
  [1023] Finding public writeable things on your linux file system - (2007-01-06)
  [1288] Linux run states, shell special commands, and directory structures - (2007-08-03)
  [1439] Linux / Unix - layout of operating system files - (2007-11-20)
  [1648] The tourists guide to Linux - (2008-05-20)
  [1765] Dialects of English and Unix - (2008-08-21)
  [1801] Will your backups work if you have to restore them? - (2008-09-18)
  [1893] Some Linux and Unix tips - (2008-11-18)
  [2299] How much space does my directory take - Linux - (2009-07-20)
  [4056] An overpractical test of our backup strategy! - (2013-03-30)
  [4063] Backups by crossover between network centres - setting up automatic scp transfers - (2013-04-13)
  [4115] More or less back - what happened to our server the other day - (2013-06-14)
  [4400] Commenting out an echo killed my bash backup script - (2015-01-19)
  [4405] Backup procedures - via backup server - (2015-01-24)
  [4481] Extracting data from backups to restore selected rows from MySQL tables - (2015-05-01)


Back to
Do NOT follow links or read attachments in these emails
Previous and next
or
Horse's mouth home
Forward to
Sad priorities
Some other Articles
OO techniques are hard to teach
the array returned by preg_match_all
Targetted Advertising
Sad priorities
Symbolic links and hard links
Do NOT follow links or read attachments in these emails
Looking up IP addresses
08:45 is a difficult time
An O level comes in handy
the Stately Homes of England
4759 posts, page by page
Link to page ... 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96 at 50 posts per page


This is a page archived from The Horse's Mouth at http://www.wellho.net/horse/ - the diary and writings of Graham Ellis. Every attempt was made to provide current information at the time the page was written, but things do move forward in our business - new software releases, price changes, new techniques. Please check back via our main site for current courses, prices, versions, etc - any mention of a price in "The Horse's Mouth" cannot be taken as an offer to supply at that price.

Link to Ezine home page (for reading).
Link to Blogging home page (to add comments).

You can Add a comment or ranking to this page

© WELL HOUSE CONSULTANTS LTD., 2024: 48 Spa Road • Melksham, Wiltshire • United Kingdom • SN12 7NY
PH: 01144 1225 708225 • EMAIL: info@wellho.net • WEB: http://www.wellho.net • SKYPE: wellho

PAGE: http://www.wellho.net/mouth/334_.html • PAGE BUILT: Sun Oct 11 16:07:41 2020 • BUILD SYSTEM: JelliaJamb