.jupyter cannot be deleted or written to - bash

My jupyter notebook command stopped working, and I believe it is because my .jupyter directory is behaving strangely.
If I try to delete it, it neither errors or gets deleted.
For example, this works, but should not.
rm -rf .jupyter
cd .jupyter
If I then run,
touch hello.txt
I get touch: hello.txt: Invalid argument
Has anyone run into this and solved it?
More Info
I don't think it's a symlink:
(py36) ➜ ~ ls -halt .jupyter
total 0
drwxr-xr-x+ 389 shleifer staff 13K Jul 5 19:25 ../
drwxr-xr-x 10 shleifer staff 320 Dec 28 2019 ./

Related

Messed up my bash_profile and bashrc files - reset to default?

I think I messed up my .bash_profile and .bashrc file.
Is there any way I can reset them to default?
When I want to access them through the terminal I get: Permission denied.
If I open them using sublime text, my .bashrc is completely empty and my .bash_profile contains the following code:
PATH="/Library/Frameworks/Python.framework/Versions/3.8/bin:${PATH}"
export PATH=/usr/local/bin:$PATH
alias python=python3
alias sublime="open -a /Applications/Sublime\ Text.app"
source ~/.profile
Any idea on what I could add/delete to any of the files?
Python does not run properly anymore since I accidentally played around on those files.
You may find the default .bash_profile and .bashrc files in /etc/skel/
[user#server /]$ ls -la /etc/skel
total 28
drwxr-xr-x. 3 root root 78 Jan 3 2019 .
drwxr-xr-x. 131 root root 12288 Nov 7 13:03 ..
-rw-r--r--. 1 root root 18 Oct 30 2018 .bash_logout
-rw-r--r--. 1 root root 193 Oct 30 2018 .bash_profile
-rw-r--r--. 1 root root 231 Oct 30 2018 .bashrc
If it's the case you can get them back:
cp /etc/skel/.bash_profile /etc/skel/.bashrc ~/
Make a backup of your current files before ;)
Just to explain: the content of /etc/skel/ is copied into the home directory of a user when created with adduser.

File not found in Gitlab-CI

I've already seen this question/answer here, but the solution isn't working for a Flutter project I'm working on.
Here's my yaml file:
image: cirrusci/flutter
variables:
before_script:
- flutter channel beta
- flutter upgrade
stages:
# - build
- test
#build:
# stage: build
# script:
# - flutter build apk
unitTests:
stage: test
script:
# - ls -la /opt/application/
# - ls -la ~/
- bash -c "echo \"$APP_VARS\" > ./cfg/env.json"
- flutter test test/widget_test.dart
Which yielded a cannot access <filename/directory>: File or Directory Not Found error with both ls -la /opt/application/ and bash -c "echo \"$APP_VARS\" > ./cfg/env.json"
Her's the output from ls -la ~/:
$ ls -la ~/
total 72
drwxr-xr-x. 1 cirrus cirrus 4096 Jul 9 19:16 .
drwxr-xr-x. 1 root root 4096 Mar 7 2018 ..
drwxr-xr-x. 1 cirrus cirrus 4096 Jul 9 19:17 .android
-rw-r--r--. 1 cirrus cirrus 220 May 15 2017 .bash_logout
-rw-r--r--. 1 cirrus cirrus 3526 May 15 2017 .bashrc
-rw-r--r--. 1 cirrus cirrus 24 Jul 9 19:16 .flutter
-rw-r--r--. 1 cirrus cirrus 675 May 15 2017 .profile
drwxr-xr-x. 1 cirrus cirrus 4096 Jul 9 19:16 .pub-cache
drwxr-xr-x. 1 cirrus cirrus 4096 Jul 9 19:16 sdks
My intent is to inject environment variables via the CI for use during testing (and hopefully deployment, although I haven't gotten that far yet).
The solution is two-part:
First, the /builds/**/cfg/ directory actually didn't exist. To fix this, you have two options-- do a mkdir or commit/push a file in the repo. I added an empty .gitignore to my cfg directory.
Then, that yielded a Permission Denied error. To solve this, I first tried to sudo my commands (which let me perform the mkdir mentioned above). When that didn't work, I did a chmod -R 777 /builds/, and that fixed my issue.
Going forward, I plan to use chmod [-R] 644 or chmod [-R] 755 instead and do a chmod +x on any files I need to run via a shell script.
I also moved my environment configuration script to the before_script: section in the gitlab YAML, but I don't believe that was necessary.
See for info on chmod.

I can copy file but can not move it from my Mac Terminal

I can copy file but can not move it on my Mac Terminal.
I want to execute following command:
mv /apps/gfss/ipt/files/R2R/Japan_WHT/21940000/DATA.xlsx /apps/gfss/ipt/files/R2R/Japan_WHT/21940000/inprogress/
And I get following error:
mv: rename /apps/gfss/ipt/files/R2R/Japan_WHT/21940000/DATA_21940000.xlsx to /apps/gfss/ipt/files/R2R/Japan_WHT/21940000/inprogress/DATA_21940000.xlsx: Permission denied
However, if I use Finder, I can move it. But I want to do this from Terminal.
But, I am able to copy:
cp /apps/gfss/ipt/files/R2R/Japan_WHT/21940000/DATA.xlsx /apps/gfss/ipt/files/R2R/Japan_WHT/21940000/inprogress/
Wondering what is that I am doing wrong!?
Below is the ls -ltr output:
gfss-apac-ipt2:21940000 admin$ pwd
/apps/gfss/ipt/files/R2R/Japan_WHT/21940000
gfss-apac-ipt2:21940000 admin$ ls -ltr
total 384
-rw-r--r--# 1 alokur wheel 193385 Nov 22 12:09 DATA_21940000.xlsx
drwxr-xr-x+ 2 admin wheel 68 Nov 22 13:08 inprogress
P.S.: Move does not work even when I do chmod 777 inprogress; and I get same error.
I asked this question here, but no luck so far.
Resolved:
I had to delete the folder /apps/gfss/ipt/files/R2R/Japan_WHT/21940000 and recreate it.
Then I cd to /apps/gfss/ipt/files/R2R/Japan_WHT/ and gave permission to 21940000 directory using chmod -R 777 21940000/
I think there was some hidden directory inside 21940000 created by some other user and hence I was unable to do chmod before.
Thanks to Ab Sin for his comments which gave me some directions to investigate.

Can't start MongoDB on OSX

I'm trying to run MongoDB on OSX and encountering a common problem, Error with exit code 1.
Here's my very simple mongod.conf:
systemLog:
destination: file
logAppend: true
path: ~/Documents/test/mongodb/mongodb.log
storage:
directoryPerDB: true
dbPath: ~/Documents/test/mongodb/mongodb_data
journal:
enabled: true
processManagement:
fork: true # fork and run in background
net:
port: 27017
I 777'd all the folders so there's no way it can be a permissions issue (right? :P)
mac$ ls -lah ~/Documents/test/mongodb/
total 8
drwxr-xr-x 5 mac staff 170B Dec 4 15:34 .
drwxr-xr-x 11 mac staff 374B Dec 4 15:19 ..
-rwxrwxrwx 1 mac staff 301B Dec 4 15:21 mongod.conf
-rwxrwxrwx 1 mac staff 0B Dec 4 15:21 mongodb.log
drwxrwxrwx 2 mac staff 68B Dec 4 15:18 mongodb_data
But it still gets this error code!
mac$ sudo mongod -f ~/Documents/test/mongodb/mongod.conf
about to fork child process, waiting until server is ready for connections.
forked process: 70062
ERROR: child process failed, exited with error number 1
Things I've tried from other questions:
Apparently I shouldn't have to run this as sudo (?), I've tried both sudo and no sudo, same result
Could be a permissions issue (Starting mongod fails unless run as root) - well the mongodb_data directory and the conf and log are all 777 so can that really be the case? I've tried chown on all of them too but no effect.
Remove the pid location in your mongod.conf (done, doesn't have any effect) Starting mongod fork, ERROR: child process failed, exited with error number 1
Also:
mongodb.log has nothing in it after multiple start attempts
mongodb_data/ has nothing in it either (no .lock file or whatever, just empty)
Any ideas?
This is probably error with log file. It's strange that yours is 0 bytes.
Anyway you do not need to make 777 permissions, you do not need to run mongod with sudo on OSX system.
Try to do the following:
mkdir ~/sometest
cd ~/sometest
cp ~/Documents/test/mongodb/mongod.conf .
Replace systemLog path to mongodb.log, replace dbpath to data
mkdir data
Start mongod (mongod -f mongod.conf)

Unable to make file editable on Mac OS X

I'm trying to edit the httpd.conf file located in /private/etc/apache2, and I can't figure out how to get permission to write
I've done
$ cd /private/etc/apache2
$ sudo chown bdh httpd.conf
$ ls -lash
0 drwxr-xr-x 13 root wheel 442B Jun 7 00:11 .
0 drwxr-xr-x 93 root wheel 3.1K Jun 26 10:51 ..
0 drwxr-xr-x 13 root wheel 442B Jan 3 16:26 extra
24 -r--r--r-- 1 bdh wheel 24K Jun 7 00:11 httpd.conf
...etc...
$ vim httpd.conf
and it says "httpd.conf" [readonly] 677L, 24330C
tried cping to the desktop, but I cant get permission to edit it there either
I'm pretty new to using the terminal, is there some other command I can use?
It is normally unnecessary and undesirable to alter access permissions to edit a file. To edit a file that requires administrator (or other user) privileges without altering the access permissions, use:
sudo -e /private/etc/apache2
Sudo's -e option tells it you want to edit the given file.
This command copies the file and makes it writable by you, tells the editor specified with the SUDO_EDITOR, VISUAL or EDITOR environment variables (they're checked in that order) to edit the file, and when the editor exits, the file is copied back to the original without altering its access permissions.
See the sudo man page for details: x-man-page://8/sudo
The chmod command is what you're looking for I believe: http://en.wikipedia.org/wiki/Chmod
chmod 777 will let anyone read, write or execute for instance.
As richardhsu correctly added, 744 is RWX, R--,R-- and thats probably what you want.

Resources