Tag Archives: Unix Server

What are symlinks / symbolic links in Linux / Unix?

Symlinks are used a lot in Linux- and Unix-based systems so you may be wondering as to what exactly a “symlink” is.  If you have Linux VPS Hosting and you use SSH, you’ll often find many files in the file structure are symlinks.

What are symlinks used for?

Symlinks are a specific type of file that has a reference to a physical location on the Linux server hard drive – such as another file or directory that exists on the machine’s hard drive. The most common symlink you’ll likely come across when using an FTP client is the www and public_html directories. The www directory is a symlink to the public_html physical directory. So this means any files or directories uploaded to the www folder is the same as doing so directly in the public_html folder. The two that seemingly look like two separate folders are merely just one. read more

Uses Of Sed Substitution In Unix Server

In this article, let us review some interesting workarounds with the “s” substitute command in sed with several practical examples.

I. Sed Substitution Delimiter

In the sed substitute command, users can use different delimiters like, @ % | ; :

We first need to create the path.txt file which is used in all the given examples

$ cat path.txt

Example 1 – sed @ delimiter: Substitute /opt/omni/lbin to /opt/tools/bin

If you substitute a path as ‘/’ and you can use @ as a delimiter instead of ‘/’. In the sed example below, in the last line of the input file, /opt/omni/lbin was changed to /opt/tools/bin.

$ sed '[email protected]/opt/omni/[email protected]/opt/tools/[email protected]' path.txt

Example 2 – sed / delimiter: Substitute /opt/omni/lbin to /opt/tools/bin

When you should use ‘/’ in path name related substitution, you have to escape ‘/’ in the substitution data as shown below. In this sed example, the delimiter ‘/’ was escaped in the REGEXP and REPLACEMENT part.

$ sed 's/\/opt\/omni\/lbin/\/opt\/tools\/bin/g' path.txt /usr/kbos/bin:/usr/local/bin:/usr/jbin/:/usr/bin:/usr/sas/bin /usr/local/sbin:/sbin:/bin/:/usr/sbin:/usr/bin:/opt/omni/bin: /opt/tools/bin:/opt/omni/sbin:/root/bin read more