I can't locate my pid file to delete it so that I can start postgresql again? - postgresql

Long story short my db didn't get shutdown correctly and I am trying to get it back up and running
I have run a
sudo find / -name postmaster.pid
to locate the file.
but when I run
sudo rm /Users/cward/Library/Application Support/Postgres/var-10/postmaster.pid
I get the following
rm: /Users/cward/Library/Application: No such file or directory
rm: Support/Postgres/var-10/postmaster.pid: No such file or directory

Your folder name contain space. You should quote the full path like this:
sudo rm "/Users/cward/Library/Application Support/Postgres/var-10/postmaster.pid"

Related

No such file or directory exists error on mac terminal while creating file for mongod

sudo mkdir -p /data/db
i want to create a missing directory fro mongod exit with status code 100. But when i try to create directory it says no such file or directory exit. I have a mac 2015 pro with version 12.02.0. Can someone help me get out of this trouble

Installing MongoDB 2022

I downloaded mongoDB and I try to use brew, it didn't work.
I try bunch of commands such as:
$ curl -O https://fastdl.mongodb.org/osx/mongodb-osx-x86_64-3.4.6.tgz
$ tar -zxvf mongodb-osx-x86_64-3.4.6.tgz
$ mkdir -p mongodb
$ cp -R -n mongodb-osx-x86_64-3.4.6/ mongodb
$ sudo mv mongodb /usr/local
Didn't work
Step 5: it says the directory is not empty or is not exist. I try to empty the directory didn't work and I try to create a different one, it didn't work.
I can't find any solution. Can someone help me, please?
I think your /usr/local folder already contains a non-empty folder named mongodb.
Refer this for details.
You can confirm it by listing out the files in it
ls /usr/local/mongodb
Maybe, you can try removing that directory as a superuser if it doesn't have any important files and continue with the installation

VS Code: NoPermissions (FileSystemError): Error: EACCES: permission denied

I'm trying to save a file called app.js on a folder called js.
Vs Code pop up this:
Failed to save 'app.js': Unable to write file 'vscode-remote://wsl+ubuntu-18.04/js/app.js'
(NoPermissions (FileSystemError): Error: EACCES: permission denied, mkdir '/js')
I tried:
sudo chown -R user /mnt/c/Users/myUser/Documents/myFolder/proyectFolder
but I still can't save this file.
Try this, fixed it for me
sudo chown -R username path
Example:
sudo chown -R emanuel /home/emanuel/test/
In the SSH terminal:
Recommended :
sudo chmod -R 777 folder_name_where_your_file_exists
or
sudo chmod -R 755 folder_name_where_your_file_exists
this works for me
sudo chown -R $USER:$USER /home/
TLDR;
If you're using a docker container, avoid making files from within the container because the owner and group permissions may cause problems with your editor (in my case VS Code)
I was running docker container for a Django project from Windows Terminal and using VS Code to edit my code.
It is a Linux file (since everything in Linux is a file) permission problem that arises because the files don't have proper user and/or group permissions. So VS Code tries to tell us that.
The problem I found only happened when I created files from within my docker container.
I would run docker exec ... bash
make new files using touch /path/to/file from the container bash
then try to edit those files on VS Code (say urls.py) only to get the scary permissions error preventing the file from saving.
I suspect that making files from within the container embellishes those files with different owner and group settings than your system would default to if you just ran the commands locally (not in the container).
Changing the file permissions with chown -hR and chgrp -hR would do the trick but to avoid the error altogether I stopped making files from within the container.
Try activating polling:
This worked for me during I tried using wsl.
The below is for individual file:
sudo chown yourUserNAme filename
For an entire directory it will be (when you write ls to terminal, you should see your directory to execute this command):
sudo chown yourUserNAme dirName
For recursive (i.e files and folders inside a folder):
sudo chown -R yourUserNAme dirName
Note: yourUserNAme is, if you do pwd under any Documents, you will see the path: /home/jhon/Documents. Here user is jhon.
Run VS Code as administrator and it will fix the problem.
https://answers.microsoft.com/en-us/windows/forum/all/error-in-vs-code-destination-directory-and-says/e70dc626-6b12-4791-a960-8b704e57098d
Install the extension Save as Root in Remote SSH in VS code.
While saving press Ctrl + Shift + P.
This open the command palette.
Search Save as Root
It is a Linux user permissions problem.
you should use the command:
sudo chown -R $USER:$USER.

Linux Mint 20 Ulyana - Cannot Remove Directory that exists but doesn't exist

1:Cannot Delete Directory
I'm using Linux Mint 20 Ulyana. I created a directory:
mkdir ./VM_Shared
It won't allow me to access or even see the directory in file explorer.
I can see it with:
ls -al
But it won't allow me to remove it:
sudo rm -dir VM_Shared - directory doesn't exist
sudo rm -dir ./VM_Shared - directory doesn't exist
sudo rm ./VM_Shared - is a directory
I also tried them without sudo.
I'm at a loss here. I cannot figure out why it won't let me delete it or access it.

What does [rm -rf /] do?

This is basically recursively remove everything from root right?
Would this really delete everything on the device?
Do any operating systems have protections against running this – like a confirmation or something?
Seemed like a better idea to ask than to try.
The rm command means it is applied for removing file-folders based on the file path but as you have specified rm -rf / it tells to remove the files which are part of the root directory in the Linux or Unix based system, but again it will not do anything until and unless you apply the command with sudo access or super user do access with your system password.
Yes this would delete recursively.
Actually their is also a protection:
rm: it is dangerous to operate recursively on '/'
rm: use --no-preserve-root to override this failsafe
rm -rf is a dangerouse command in linux.if rm -rf run with root privilage it force to delete all files and folders even hidden file and you must install os again. this command has not confirmation question.
As a security measure, you can set rm to always get you approved for the delete operation, it uses the "-i" option whenever you want to delete a file or directory. To make this command permanent, add the following alias to the $ HOME / .bashrc file.
When you run the rm command, it will run with the "-i" option by default. (If you use the "-f" option, these settings will be overwrite)
rm -rf
this code deletes all files on linux (system ,root files include)
this is very dangerous code