xgqfrms™, xgqfrms® : xgqfrms's offical website of cnblogs! xgqfrms™, xgqfrms® : xgqfrms's offical website of GitHub!

Linux chown -R & chmod 777 & chmod +x All In One

Linux chown -R & chmod 777 & chmod +x All In One

chown

https://linux.die.net/man/1/chown

  1. chown - change file owner and group

https://linux.die.net/man/2/chown

  1. chown, fchown, lchown - change ownership of a file ✅

https://www.geeksforgeeks.org/chown-command-in-linux-with-examples/

MongoDB

# start service
$ mongod

# start mongodb REPL instance
$ mongo

$ sudo mkdir -P /data/db
$ whoami
# xgqfrms-mbp

# sudo chown -R ur/username /data/db
$ sudo chown -R xgqfrms-mbp /data/db

# list services
$ brew services list

$ brew services start mongodb
$ brew services stop mongodb

https://www.youtube.com/watch?v=GTuJ1p7gpx4

chmod

  1. chmod - change file mode bits
chmod [OPTION]... MODE[,MODE]... FILE...
chmod [OPTION]... OCTAL-MODE FILE...
chmod [OPTION]... --reference=RFILE FILE...

https://linux.die.net/man/1/chmod

  1. chmod, fchmod - change permissions of a file ✅
#include <sys/stat.h>

int chmod(const char *path, mode_t mode);
int fchmod(int fd, mode_t mode);

https://linux.die.net/man/2/chmod

chmod +x / chmod 755

chmod +x === chmod 755

# chmod +x is equal to chmod ugo+x (Based on umask value)
# chmod 755 is equal to chmod u=rwx,go=rx

$ chmod +x
$ chmod 755
$ chmod u=rwx,go=rx

755

# rwx = 7
# r-x = 5
# r-x = 5

$ ls -alth
-rwxr-xr-x

chmod 777

777

# rwx = 7
# rwx  = 5
# rwx  = 5

$ ls -alth
-rwxrwxrwx

image

demos

#!/bin/sh

# echo "^-v-^ JSON DB is running in development env!" && npm run db

# echo "^-v-^ JSON DB is running in development env!" && nodemon -w ./server.js localhost 8888

JSONDB="nodemon -w ./server.js localhost 8888"

${JSONDB} &
# chmod +x db.sh
# sudo ./db.sh
# nodemon -w ./server.js localhost 8888

# /bin/sh db.sh

# ps -ef | grep node
# sudo kill -9 <PID>

(🐞 反爬虫测试!打击盗版⚠️)如果你看到这个信息, 说明这是一篇剽窃的文章,请访问 https://www.cnblogs.com/xgqfrms/ 查看原创文章!

refs

https://zzk.cnblogs.com/my/s/blogpost-p?Keywords=chmod

https://www.cnblogs.com/xgqfrms/p/9546961.html



©xgqfrms 2012-2021

www.cnblogs.com/xgqfrms 发布文章使用:只允许注册用户才可以访问!

原创文章,版权所有©️xgqfrms, 禁止转载 🈲️,侵权必究⚠️!


posted @ 2020-07-09 22:31  xgqfrms  阅读(5410)  评论(1编辑  收藏  举报