首页 > 系统相关 >Linux xattr shell command All In One

Linux xattr shell command All In One

时间:2022-12-21 01:00:32浏览次数:46  
标签:00 shell tt xa tr command file xattr

Linux xattr shell command All In One

macOS

$ man xattr > xattr.md

image

man xattr

XATTR(1)                     General Commands Manual                    XATTR(1)

NNAAMMEE
     xxaattttrr – display and manipulate extended attributes

SSYYNNOOPPSSIISS
     xxaattttrr [--llrrssvvxx] _f_i_l_e _._._.
     xxaattttrr --pp [--llrrssvvxx] _a_t_t_r___n_a_m_e _f_i_l_e _._._.
     xxaattttrr --ww [--rrssxx] _a_t_t_r___n_a_m_e _a_t_t_r___v_a_l_u_e _f_i_l_e _._._.
     xxaattttrr --dd [--rrssvv] _a_t_t_r___n_a_m_e _f_i_l_e _._._.
     xxaattttrr --cc [--rrssvv] _f_i_l_e _._._.
     xxaattttrr --hh | ----hheellpp

DDEESSCCRRIIPPTTIIOONN
     The xxaattttrr command can be used to display, modify or remove the extended
     attributes of one or more files, including directories and symbolic links.
     Extended attributes are arbitrary metadata stored with a file, but separate
     from the filesystem attributes (such as modification time or file size).
     The metadata is often a null-terminated UTF-8 string, but can also be
     arbitrary binary data.

     One or more files may be specified on the command line.  For the first two
     forms of the command, when there are more than one file, the file name is
     displayed along with the actual results.  When only one file is specified,
     the display of the file name is usually suppressed (unless the --vv option
     described below, is also specified).

     In the first form of the command (without any other mode option specified),
     the names of all extended attributes are listed.  Attribute names can also
     be displayed using “ls -l@”.

     In the second form, using the --pp option (“print”), the value associated
     with the given attribute name is displayed.  Attribute values are usually
     displayed as strings.  However, if nils are detected in the data, the value
     is displayed in a hexadecimal representation.

     The third form, with the --ww option (“write”), causes the given attribute
     name to be assigned the given value.

     The fourth form, with the --dd option (“delete”), causes the given attribute
     name (and associated value), to be removed.

     In the fifth form, with the --cc option (“clear”), causes all attributes
     (including their associated values), to be removed.

     Finally, the last form, with either the --hh or ----hheellpp option, displays a
     short help message and exits immediately.

OOPPTTIIOONNSS
     --ll  By default, the first two command forms either displays just the
         attribute names or values, respectively.  The --ll option causes both the
         attribute names and corresponding values to be displayed.  For
         hexadecimal display of values, the output is preceeded with the
         hexadecimal offset values and followed by ASCII display, enclosed by
         “|”.

     --rr  If a file argument is a directory, act as if the entire contents of the
         directory recursively were also specified (so that every file in the
         directory tree is acted upon).

     --ss  If a file argument is a symbolic link, act on the symbolic link itself,
         rather than the file that the symbolic link points at.

     --vv  Force the file name to be displayed, even for a single file.

     --xx  Force the attribute value to be displayed in the hexadecimal
         representation.

         The --ww option normally assumes the input attribute value is a string.
         Specifying the --xx option causes xxaattttrr to expect the input in
         hexadecimal (whitespace is ignored).  The xxd(1) command can be used to
         create hexadecimal representations from exising binary data, to pass to
         xxaattttrr.

EEXXIITT SSTTAATTUUSS
     The xxaattttrr command exits with zero status on success.  On error, non-zero is
     returned, and an error message is printed to the standard error.  For
     system call errors, both the error code and error string are printed (see
     getxattr(2), listxattr(2), removexattr(2) and setxattr(2) for a complete
     list of possible error codes).

     Some attribute data may have a fixed length that is enforced by the system.
     For example,

           % xattr -w com.apple.FinderInfo 0 foo
           xattr: [Errno 34] Result too large: 'foo'

     The com.apple.FinderInfo attribute must be 32 bytes in length.

EEXXAAMMPPLLEESS
     This example copies the com.apple.FinderInfo attribute from the /usr
     directory to the MyDir directory:

           % xattr -px com.apple.FinderInfo /usr
           00 00 00 00 00 00 00 00 40 00 00 00 00 00 00 00
           00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
           % xattr -l MyDir
           % xattr -wx com.apple.FinderInfo \
             "`xattr -px com.apple.FinderInfo /usr`" MyDir
           % xattr -l MyDir
           com.apple.FinderInfo:
           00000000  00 00 00 00 00 00 00 00 40 00 00 00 00 00 00 00  |........@.......|
           00000010  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  |................|
           00000020

SSEEEE AALLSSOO
     ls(1), xxd(1), getxattr(2), listxattr(2), removexattr(2), setxattr(2)

macOS 12.3                      November 29, 2010                     macOS 12.3

demos

error ❌

“Custom-Chrome.app” is damaged and can’t be opened. You should move it to the Trash.

solution ✅

# $ sudo spctl --master-disable

$ xattr -cr /Users/$USER/Desktop/Custom-Chrome.app

(

标签:00,shell,tt,xa,tr,command,file,xattr
From: https://www.cnblogs.com/xgqfrms/p/16995435.html

相关文章

  • Linux Shell开发功能点
    背景需要操作一批次服务器安装Docker功能特色一键执行bash<(curl-s-Lhttp://server.com/installDocker.sh)MemberNode参数传递hostname修改if[!-n"$1"......
  • 交互式shell 非交互式shell
    发现问题是:自己写的zookeeper的一键启动脚本一直启动不了zookeeper集群于是把这个命令单拎出来执行:通过ssh远程连接主机192.168.88.110执行zookeeper服务zkServer.shssh......
  • shell 判断是否已安装了某个软件
    判断是否安装了node复制if!typenode>/dev/null2>&1;thenecho'node未安装';elseecho'node已安装';fi判断是否安装了npmif!typenpm>/dev/null......
  • json提取器和beanshell处理器组合,将提取的所有id以数组返回
    1.添加json提取器2.添加beanshell处理器,并编写脚本Stringstr1=vars.get("buildid_ALL");log.info(str1);Listlist=Arrays.asList(str1.split(","));log.info(......
  • 正则提取器和beanshell处理器组合,将提取的所有id拼接成字符串
    1.添加正则表达式,提取所有id值2.添加beanshell处理器将所有的id值拼接成字符串方法一:intN=Integer.parseInt(vars.get("build_matchNr"));log.info(N.toString())......
  • 【转载】用shell命令一步步获取Java版本号
    https://blog.csdn.net/f20052604/article/details/100269768 1、打印java-version命令echo$(java-version)输出javaversion"1.8.0_171"Java(TM)SERuntimeEnvi......
  • 日志切割: logrotate、python、shell实现
    对于Linux系统安全来说,日志文件是极其重要的工具。不知为何,我发现很多运维同学的服务器上都运行着一些诸如每天切分Nginx日志之类的CRON脚本,大家似乎遗忘了Logrotate,争相发......
  • shell脚本判断一个数是否为素数
    #!/bin/bashletisPrime=1echo"inputanumber:"readnif[${n}-le1]thenletisPrime=2fifor((i=2;i<n;i++))dolettmp=$(($n%$i))if[$tmp-......
  • Shell 变量知多少?
    bashshell编程和其他编程语言差不多,同样包含变量(存放字符串和数值的容器,可以进行修改、比较、传递)。在引用bash变量时,可以使用一些非常特殊的运算符。bash还拥有内建变......
  • 嵌入式adb shell命令与bat批处理自动执行
    1.目的连接adb后,需要上传脚本到设备内,且chmod授权限,这一条条命令手动操作有点繁锁,所以可写bat命令自动执行。 2.手动操作1.cmd到adb所在程序目录2.上传文件adbpus......