Obtain file permissions in linux

Source: Internet
Author: User
In linux, how does one obtain file or folder permissions? Www.2cto. comls-ld/home/| awk & amp; #39; {print $1} & amp; #39; | sed & amp; #39; s/^ [a-zA-Z-] // & amp; #39; rwxr-xr-x [root @ localhostarray_study] # e
In linux, how does one obtain file or folder permissions? Www.2cto.com ls-ld/home/| awk '{print $1}' | sed's/^ [a-zA-Z-] // 'rwxr-xr-x [root @ localhost array_study] # echo "obase = 8; ibase = 2; 'ls-ld/home/| awk' {print $1} '| sed's/^ [a-zA-Z-] //' | tr 'X | r | w''1' | tr'-''0'' "| bc755 can also be encapsulated as a function: script name: power01.sh content: Shell code #! /Bin/sh power () {file_name = "$1" $ command_l if [-d "$ file_name"]; then command_l = "ls-ld" else command_l = "ls-l" fi echo "obase = 8; ibase = 2; '$ command_l "$ file_name" | awk' {print $1} '| sed's/^ [a-zA-Z-] //' | tr 'X | r | w''1' | tr'-''0'' "| bc} power" $1 "[root @ localhost power_study] # sh power01.sh/home/whuang/700 [root @ localhost power_study] # ll-d/home/whuang/drwx ------ 53 whuang 4096 11-29/home/whuang/

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.