首页 > 系统相关 >Linux file system All In One

Linux file system All In One

时间:2023-10-08 17:25:06浏览次数:41  
标签:11 4.0 drwxr system sh file Linux xr eric

Linux file system All In One

图解 Linux 文件系统

image

image

image

file type

- file
d directory
b block
l symbol link (soft link / hard link)

file permissions

3 个字组,共三组;

  1. user permission 用户权限
  2. group permission 组权限
  3. other permission 其他权限

每组符号表示的含义(权重):

  • w === 4
  • r === 2
  • x === 1

可以能的组合,枚举值

  • wrx === 7
  • wr- === 6
  • w-x === 5
  • w-- === 4
  • -rx === 3
  • -r- === 2
  • --x === 1
  • --- === 0

wrxw-xw-x === 755

$ chmod +x
# 等价于
$ chmod 755

chown

changing ownership in Linux

$ chown name filename
$ chown name foldername

shell script to change directory permissions

??? ch dir / change folder ???

$ mkdir folder_test

# chown -R
$ chown -R folder_test

$ man chown > man-chown.md
#!/bin/bash

source /generic/utils/etc/environments/perm.conf

cd $ENVR
DIRS=`ls -l $ENVR | egrep '^d' | awk '{print $9}'`

for DIR in "${DIRS[@]}";
do
    echo "$DIR"
        echo "Which environment do you want?: "
        echo -n "> "
        read i
echo "Changing permissions now..."

sudo chown -R $OWN:$GRP "$i" && sudo chmod -R $MOD1 "$i"
#cd $ENVR/$i
#sudo chmod -R $MOD2 *

echo "Permissions are changed!"

done

demos

system environment variables

# global variable
$ export NVM_USER=xgqfrms_pi4b
$ echo $NVM_USER
xgqfrms_pi4b
$ touch test.sh
$ vim test.sh
$ sudo chmod +x ./test.sh
#!/usr/bin/env bash

echo $NVM_USER
echo "string with a variable $NVM_USER"
echo string with a variable $NVM_USER
echo "string with a variable ${NVM_USER}"
# hard link
$ ln test.sh test-hard-link.sh
# soft link
$ ln -s test.sh test-soft-link.sh

$ ls -al
总用量 152
drwxr-xr-x 17 eric eric  4096 10月  8 16:45 .
drwxr-xr-x  4 root root  4096  9月 19 15:51 ..
-rw-------  1 eric eric 16213 10月  8 12:51 .bash_history
-rw-r--r--  1 eric eric   220  5月  3 10:53 .bash_logout
-rw-r--r--  1 eric eric  3912  9月 21 13:08 .bashrc
drwxr-xr-x  2 eric eric  4096  5月  3 11:02 Bookshelf
drwxr-xr-x  6 eric eric  4096  9月 20 22:55 .cache
drwx------  6 eric eric  4096  5月  3 11:24 .config
drwxr-xr-x  4 eric eric  4096 10月  6 23:16 Desktop
drwxr-xr-x  2 eric eric  4096  5月  3 11:24 Documents
drwxr-xr-x  2 eric eric  4096  5月  3 11:24 Downloads
drwxr-xr-x  3 eric eric  4096  5月  3 11:02 .local
drwxr-xr-x  2 eric eric  4096  5月  3 11:24 Music
-rw-------  1 eric eric   111 10月  7 15:37 .node_repl_history
drwxr-xr-x  5 eric eric  4096 10月  7 01:27 .npm
drwxr-xr-x  8 eric eric  4096  9月 21 11:01 .nvm
-rw-r--r--  1 eric eric   411  9月 21 11:37 nvm_echo_test.sh
drwxr-xr-x  2 eric eric  4096  5月  3 11:24 Pictures
-rw-r--r--  1 eric eric   807  5月  3 10:53 .profile
drwxr-xr-x  2 eric eric  4096  5月  3 11:24 Public
drwxrwxrwx  2 eric eric  4096  9月 16 04:21 Share
-rwxr-xr-x  1 eric eric   172  9月 21 18:03 shell-env-variable-test.sh
-rwxr-xr-x  1 eric eric   196  9月 21 16:58 shell-variable.sh
drwxr-xr-x  2 eric eric  4096  5月  3 11:24 Templates
-rwxr-xr-x  2 eric eric   156  9月 21 13:15 test-hard-link.sh
-rwxr-xr-x  2 eric eric   156  9月 21 13:15 test.sh
lrwxrwxrwx  1 eric eric     7 10月  8 16:44 test-soft-link.sh -> test.sh
drwxr-xr-x  2 eric eric  4096  5月  3 11:24 Videos
-rw-------  1 eric eric 19119 10月  7 20:47 .viminfo
-rw-------  1 eric eric    50  9月 30 11:48 .Xauthority
-rw-------  1 eric eric  2604  9月 30 11:48 .xsession-errors
-rw-------  1 eric eric  2604  9月 25 22:17 .xsession-errors.old
eric@rpi4b:~ $ 


image

$ ls -alh
总用量 152K
drwxr-xr-x 17 eric eric 4.0K 10月  8 16:45 .
drwxr-xr-x  4 root root 4.0K  9月 19 15:51 ..
-rw-------  1 eric eric  16K 10月  8 12:51 .bash_history
-rw-r--r--  1 eric eric  220  5月  3 10:53 .bash_logout
-rw-r--r--  1 eric eric 3.9K  9月 21 13:08 .bashrc
drwxr-xr-x  2 eric eric 4.0K  5月  3 11:02 Bookshelf
drwxr-xr-x  6 eric eric 4.0K  9月 20 22:55 .cache
drwx------  6 eric eric 4.0K  5月  3 11:24 .config
drwxr-xr-x  4 eric eric 4.0K 10月  6 23:16 Desktop
drwxr-xr-x  2 eric eric 4.0K  5月  3 11:24 Documents
drwxr-xr-x  2 eric eric 4.0K  5月  3 11:24 Downloads
drwxr-xr-x  3 eric eric 4.0K  5月  3 11:02 .local
drwxr-xr-x  2 eric eric 4.0K  5月  3 11:24 Music
-rw-------  1 eric eric  111 10月  7 15:37 .node_repl_history
drwxr-xr-x  5 eric eric 4.0K 10月  7 01:27 .npm
drwxr-xr-x  8 eric eric 4.0K  9月 21 11:01 .nvm
-rw-r--r--  1 eric eric  411  9月 21 11:37 nvm_echo_test.sh
drwxr-xr-x  2 eric eric 4.0K  5月  3 11:24 Pictures
-rw-r--r--  1 eric eric  807  5月  3 10:53 .profile
drwxr-xr-x  2 eric eric 4.0K  5月  3 11:24 Public
drwxrwxrwx  2 eric eric 4.0K  9月 16 04:21 Share
-rwxr-xr-x  1 eric eric  172  9月 21 18:03 shell-env-variable-test.sh
-rwxr-xr-x  1 eric eric  196  9月 21 16:58 shell-variable.sh
drwxr-xr-x  2 eric eric 4.0K  5月  3 11:24 Templates
-rwxr-xr-x  2 eric eric  156  9月 21 13:15 test-hard-link.sh
-rwxr-xr-x  2 eric eric  156  9月 21 13:15 test.sh
lrwxrwxrwx  1 eric eric    7 10月  8 16:44 test-soft-link.sh -> test.sh
drwxr-xr-x  2 eric eric 4.0K  5月  3 11:24 Videos
-rw-------  1 eric eric  19K 10月  7 20:47 .viminfo
-rw-------  1 eric eric   50  9月 30 11:48 .Xauthority
-rw-------  1 eric eric 2.6K  9月 30 11:48 .xsession-errors
-rw-------  1 eric eric 2.6K  9月 25 22:17 .xsession-errors.old

(

标签:11,4.0,drwxr,system,sh,file,Linux,xr,eric
From: https://www.cnblogs.com/xgqfrms/p/17749571.html

相关文章

  • Linux系列---【shell脚本-模拟手动跑每天的定时任务】
    问题背景上线的时候经常会遇到这样的问题,上线一个每天跑的定时任务,一般跑最近一年的数据,上线的时候需要手动跑过去最近一年的数据,手动肯定不方便,于是这里写了一个好用的shell脚本,来降本增效。shell脚本#!/bin/bash#设置循环的日期范围start_date="20230801"end_date="20......
  • Linux检测远程服务器端口的几种方法
    1,telnet命令检测telnet是Windows和Linux上最常用的检查端口的命令。此命令的简单用法是telnetip地址(或者域名)端口。如果执行telnet命令提示命令未发现,请执行"yuminstalltelnet"。[root@localhostetc]#telnetwww.baidu.com443 通过上图可以看出,百度htt......
  • shell脚本执行make不一定调用Makefile
    今天在研究安卓编译流程时发现,shell脚本内执行make并不会调用当前路径下的Makefile,这有点让我大吃一惊。一番定位过后,发现执行make时调用的是另外一个shell脚本内定义的make函数,所以猜想可能GNUMake工具发现make有定义,所以直接调用该函数去了。于是我做了如下实验进行猜想验......
  • DockerFile部署wordpress并制作成镜像实践
    目录DockerFile部署wordpress实践部署wordpress准备Dockerfile所需文件开始制作成镜像访问网页将wordpress打包成镜像DockerFile部署wordpress实践部署wordpress#创建dockerfile目录[root@docker02~]#mkdir/Dockerfile#进入dockerfile目录[root@docker02......
  • Linux下PureFTPd配置安装(完整版)
    PureFTPd是一个centos中ftp服务器软件了,我们在网上有很多的关于PureFTPd安装教程了,下面小编来为各位介绍Linux下PureFTPd配置安装教程.网上关于pureftp的安装教程很多,但是试了以后发现很多其实都不完善,很容易出错,自己安装摸索以后总结如下.首先安装之前最好用netstat-ntl......
  • linux酷炫命令 hollywood
    1、https://cloud.tencent.com/developer/article/2275804ubuntu系统安装说实话这个命令可能就是抖音里很火的那个,你眼中的程序猿VS现实中的程序猿,安装命令如下:sudoapt-getinstallhollywood执行结果如下: 5.cal命令    2、......
  • Linux cat、echo、seq、sort、cut、tr、diff、uniq
    cat和echo特点:cat:从文件或标准输入读取内容并显示到标准输出(通常是屏幕)。提供一个或多个文件名作为参数时,cat会连续显示这些文件的内容。echo:输出参数内容到标准输出,提供给echo的任何内容(无论是文本、变量还是混合内容)都会被当作参数,然后echo将这些参数显示出来。c......
  • [ACTF2020 新生赛]BackupFile
    原理字符串和数字弱比较问题代码审计目录扫描解题过程进入靶场就让我们找sourcefile,原代码也没其他东西了,只能扫目录了pythondirsearch.py-u3c33c7f9-7306-4c4e-99a6-13b8ef0803b9.node4.buuoj.cn:81--delay=3扫出来index.php.bak文件,下载下来源码为<?phpinclude......
  • Linux问题记录
    Linux问题记录​#Linux问题记录#​用户不在sudoers文件中,此事将被报告我们首先使用命令suroot切换至root用户,此时需要验证root用户密码然后我们查看/etc/sudoers文件内容是否包含当前用户权限如果没有权限,使用命令vim/etc/sudoers编辑文件增加shone用......
  • Linux:远程Ubuntu服务器误修改sudoers 导致无法sudo的解决办法
    问题复现本来想用腾讯云测试一下用户权限管理,给test用户设置面密码登录,修改/etc/sudoers如下testALL=(ALL:ALL)NOPASSWD:ALL手抖忘了写NOPASSWD后面的冒号,导致关闭后sudo直接报错(base)ubuntu@VM-16-11-ubuntu:~$sudovim/etc/sudoers>>>/etc/sudoers:syntaxe......