accidentally created a symbolic link - apache

I accidentally created a symbolic link of sites-available inside sites-enabled. Now, I don't know what happened but I did a rm -rf sites-available to delete the symbolic link, but that is not what happened. Instead, all my configuration files inside sites-available was deleted. The worst is the symbolick link of sites-available is still inside the sites-enabled. I tried rm -f sites-available but it won't delete it. How can I get rid of this?

Have you changed directory to sites-enabled, if you want to remove symlink then change directory to correct path:
cd path/sites-enabled
and then remove sites-available, but first make sure no longer you need it.
rm -vf sites-available

Note the difference between
rm -rf symboliclink
and
rm -rf symboliclink/

Related

Can't remove node_modules folder with symlink

I can't delete node_modules folder because there is symlink on my macbook with m1
Already tried chown and chmod. Didn't help...

How to locate or find nvm(node verison manager )file

I'm trying to find the location of nvm file.
I want to remove it, and I want to reinstall it.
I have faced a problem with finding the location of nvm file
logos1056#logos1056-Vostro-3578:~$ nvm ls
N/A
node -> stable (-> N/A) (default)
iojs -> N/A (default)
logos1056#logos1056-Vostro-3578:~$ rmdir $NVM_DIR
rmdir: failed to remove '/home/logos1056/.nvm': Directory not empty
logos1056#logos1056-Vostro-3578:~$ /home/logos1056/.nvm
bash: /home/logos1056/.nvm: Is a directory
logos1056#logos1056-Vostro-3578:~$ cd /home/logos1056/.nvm
logos1056#logos1056-Vostro-3578:~/.nvm$ rmdir $NVM_DIR
rmdir: failed to remove '/home/logos1056/.nvm': Directory not empty
nvm is usually installed in your home directory within a hidden folder called .nvm.
$NVM_DIR is the environment variable that contains the path to nvm.
You want to remove the directory and all its content. You can do it this way.
$ rm -rf $NVM_DIR
Then you can install nvm again.
Oneliner,
rm -rf $NVM_DIR ~/.npm ~/.bower

how to reuse the root node_modules of the project?

I get a dir structure like below.
|-root
|-package.json
|-node_modules
|-01
|-package.json
|-02
|-package.json
Could I just share the node_modules which locate in root?because the dependencies of other subDir(like 01 and 02) is same with the root's. I don't want to install the same npm package again. I need the separate package.json in subDir because it will contain different scripts to run different tasks. put all the script inside the root package.json is messy.
I have try symlink, but it dosen't work. npm log package not found.
export NODE_PATH='yourdir'/node_modules
Refer Node documentation https://nodejs.org/api/modules.html#modules_loading_from_the_global_folders
problem solved. symlink is work. I made a mistake when use command ln.
# in root dir
# wrong
> ln -s ./node_modules ./01
# right
> ln -s /full/path/to/root/node_modules /full/path/to/root/01

Unable to stop tracking JetBrains .idea files

I have added the .idea files to my .gitignore file and that seems to work fine. Since my .idea files were tracked already, though, earlier posts have suggested the following code, to get them out from under version control.
git rm -rf .idea
or
git rm -r --cached .idea
In either case, though, I get the message:
fatal: pathspec '.idea' did not match any files.
When I list my files in this folder, though, .idea is right up top.
What am I doing wrong?
fatal: pathspec '.idea' did not match any files.
assuming there would be no file with the name .idea on the path
Since you are trying to remove the entire folder change your command
git rm -r --cached .idea
to
git rm -r --cached .idea/

Adding files to .gitignore doesn't remove them from "untracked files"?

I recently started using git-svn, and tried to tell Git to ignore any files that the Subversion repo ignores (mostly binaries and object files), by running "git svn show-ignore >> .gitignore"
Then I ran git status, and saw that many of those files that are now on my .gitignore list, are still showing up under "untracked files". Why? What do I need to do to fix this?
Or am I going about this the wrong way? I just want to be able to run "git add ." without it adding in all that junk to the commit.
Thanks.
If you already imported those files in the Git repo, they won't be ignored until you git rm --cached them.
You need to remove those file from the Git index (hence the --cached option), before seeing the .gitignore working.