111

I want to create a symlink that should point to another directory.

Like inside directory /var/www/vhosts/ecash-staging.com/ should be a symlink named as ecash_root that should pointing to --> /var/www/vhosts/ecash_cfe.

How is this possible ?

I have googled but there some people said that there should be a dir ecash_root exist in /var/www/vhosts/ecash_cfe/... but I do not want that.

i just have to create symlink in /var/..../ecash-staging.com/ name as ecash_root that should point to /var/www/vhosts/ecash_cfe but should not be a ecash_root dir inside /var/www/vhosts/ecash_cfe.

thanks to all

2
  • 2
    open a terminal, enter ln --help or/and man ln and read it for additional information... Oct 31 '16 at 6:22
  • You needed to be in Target folder ln -s <source-file> name Apr 16 '19 at 7:55
162

Use ln:

ln -s /var/www/vhosts/ecash_cfe /var/www/vhosts/ecash-staging.com/ecash_root
  • -s stands for symbolic link

  • /var/www/vhosts/ecash_cfe is the source file

  • /var/www/vhosts/ecash-staging.com/ecash_root is the link name

7
  • 1
    2 commands worked for me . one of them that is @heemayl mentioned above . and other one in current directory just ran the command ls -s /var/www/vhosts/ecash_cfe ecash_root . same worked both . good .
    – Waqas Rana
    Oct 31 '16 at 6:31
  • 1
    @heemayl isn't it the other way around? Feb 21 '17 at 15:45
  • nope, target goes first, see docs, also @WaqasRana's comment mentions the wrong command "ls"
    – Efren
    Feb 4 '18 at 23:47
  • 12
    For me, this creates a file... Dec 17 '18 at 21:31
  • 1
    ln -s target_directory short_cut_file_path_and_name Example : ln -s /media/ ./media_shortcut Explanation : Creating shortcut file in the same directory with name media_shortcut which references to /media/ directory Aug 6 '19 at 6:11

Not the answer you're looking for? Browse other questions tagged or ask your own question.