How to create update or remove symbolic or soft link Linux


Symbolic links , Symlink or Soft link in Unix are very important concept to understand and use in various UNIX operating systems e.g. Linux , Solaris or IBM AIX. Symlinks gives you so much power and flexibility that you can maintain things quite easily.I personally feel that along with find, grep and other UNIX commands, command to create soft link and update soft link i.e. ln -s  is also must for any one working in UNIX machine. Whenever I do scripting or write any UNIX script I always write for symlinks rather than pointing to absolute path of directories in UNIX. It gives you flexibility of changing the symlink or soft link without making any change on your tried and tested scripts. I have worked on many different core Java projects which run on Linux and UNIX machine and make extensive use of UNIX symbolic links or symlinks. All my project which are on finance domain and on electronic trading systems have there server running on Linux,  Since speed is major concern in online stock or futures trading where orders has to hit the market within micro seconds Linux server is ideal choice for electronic and fix trading systems and since your server is on UNIX you have to be expert of Unix command to work efficiently and these articles are my result of those effort to learn and share new UNIX commands. In this UNIX fundamental tutorial we will see How to create soft link in UNIX, How to update soft link and Difference between Soft link and Hard link in Unix and Linux. By the way this UNIX command tutorial is  in continuation of my earlier article top networking commands in Unix  and CVS command examples ,  if you haven’t read already you may find some useful information based on my experience in Unix and Linux commands.



First difference between soft link and hard link is that  Unix Soft links are pointers to programs, files, or directories located elsewhere (just like Windows shortcuts) , while Unix Hard links are pointers to programs and files, but NOT directories.
2) Second major difference between UNIX soft link and hard link is that If the original program, file, or directory is renamed, moved, or deleted, the soft link is broken and it will show in red color if you using ls -lrt --color option. On the other hand, If the original program or file is renamed, moved, or deleted, the hard link is NOT broken
3) One not so important difference on soft link vs hard link is that,  If you type ls -F you can see which files are UNIX soft links because they end with @

4)  Another difference between soft link vs hard link is how you create them, To create a soft link called "current" that points to a file or directory called "new_package", use this: ln -s new_package latest  to remember this command always remember that name of soft link comes as last argument. On the other side to create a UNIX hard link called myhardlink.txt that points to a file called myfile.txt, use this: ln myfile.txt myhardlink.txt

5) One more significant difference on soft link and hard link on UNIX or Linux is that, soft link can point to a network mounted directory also. For creating unix soft link remember to use option "-s" with UNIX link command "ln". While, Hard links in UNIX cannot span disk drives, so you CANNOT have a hard link on /dev/hdb that refers to a program or file on /dev/hda
Related Posts:
  • $_ENV and $_SERVER ? PHP sets several variables for you containing information about the server, the environment, and your visitor's request. These are stored in the superglobal arrays $_ENV and $_SERVER, but their availability depends on whe… Read More
  • Associative Arrays? You can use string values as keys. For example, you might create an arraylike this: $myStuff = array();$myStuff[“name”] = “andy”;$myStuff[“email”] = “andy@fsdsd.ca”;Print $myStuff[“name”]; Associative arrays are different t… Read More
  • What is triggers? A trigger is a database object which is associated with particular database table. Triggers gets called automatically when particular event(INSERT, UPDATE, DELETE) occurs on table. … Read More
  • How we know browser properties? echo $_SERVER['HTTP_USER_AGENT']; $browser = get_browser(); foreach ($browser as $name => $value) { echo “$name $value \n”; } get_browser   returns the capabilities of the user's browser. … Read More
  • What are the different tables present in mysql? Total 5 types of tables we can create 1. MyISAM 2. Heap 3. Merge 4. InnoDB 5. ISAM 6. BDB MyISAM is the default storage engine … Read More
  • Checking Variable Values and Types FUNCTION is_numeric() True if number or numeric stringctype_digit() True if all digits are numeric charactersis_bool() True if variable is a Booleanis_null() True if variable is NULLis_float() True if variable type is a fl o… Read More
  • Pagination in PHP and MySQL <?php function pagination($per_page = 10, $page = 1, $url = '', $total){ $adjacents = "2"; $page = ($page == 0 ? 1 : $page); $start = ($page - 1) * $per_page; $prev = $page - 1; $next = $page + 1; $lastpage = ceil… Read More
  • magic_quotes_gpc, magic_quotes_runtime Magic quotes is the name of a PHP feature that automatically quotes inputdata, by using the addslashes() function. Historically, this was used so thatform data could be used directly in SQL queries without any security or qu… Read More
  • Web server compression? The best way to understand web server compression is to think of sending ZIP filesinstead of uncompressed files from your web server to your web user. Sending less dataover the network will minimize network latency and your … Read More
  • Cookies Versus Sessions?  Cookies The setcookie( ) call needs to be before the HTML form because of the way the web works. HTTP operates by sending all "header" information before it sends "body" information. In the header, it sends t… Read More
  • How get the value of current session id? Session_id() returns the session id for the current session. … Read More
  • php interview questions PHP Interview Questions and Answers Click  this  link   … Read More
  • PHP? PHP (Hyper text Pre Processor) is a scripting language commonly used for web applications … Read More
  • What is LAMP? LAMP means combination of Linux, Apache, MySQL and PHP. … Read More
  • $_GET , $_POST,$_COOKIE?? $_GET contains any variables provided to a script through the GET method.  $_POST contains any variables provided to a script through the POST method.  $_COOKIE contains any variables provided to a script through a… Read More